<commit_before>/*****************************************************************************
 * Copyright (C) 2011-2015 <NAME>
 *
 * Author: <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *****************************************************************************/

#ifndef __TABLE_H__
#define __TABLE_H__

#include <string>

#include "decode/decoder.h"
#include "decode/descriptor/descriptor.h"

namespace dvbtee {

namespace decode {


class TableWatcher;

class TableBase: public Decoder {
public:
	const uint8_t& getTableid() const;
	void reset();

protected:
	TableBase(Decoder*, std::string&, uint8_t, TableWatcher*);
	virtual ~TableBase();

	TableWatcher *m_watcher;

	DescriptorStore descriptors;

private:
	const uint8_t m_tableid;

	void init();
};

class Table: public TableBase {
public:
	Table(Decoder*, std::string&, uint8_t, TableWatcher*);
	virtual ~Table();
};

class TableWatcher {
public:
	TableWatcher() {}
	virtual ~TableWatcher() {}

	virtual void updateTable(uint8_t tId, Table*) = 0;
};

class TableDataComponent: public LinkedDecoder {
public:
	TableDataComponent(Decoder*, std::string&);
	virtual ~TableDataComponent();

	DescriptorStore descriptors;
};

#define PsiTable_CONSTRUCTORTEMPLATE 0
struct PsiTable {
#if PsiTable_CONSTRUCTORTEMPLATE
    PsiTable(const PsiTable& o) : m_priv(o.m_priv) { }
    template<typename T> PsiTable(const T* p) : m_priv(p) { }
#else
    PsiTable() : m_priv(NULL) { }
    template<typename T> void Set(const T* p) { m_priv = p; }
#endif
    template<typename T> const T* Get() const { return (!m_priv) ? NULL : ((T*)m_priv); }

private:
    const void *m_priv;
};

class TableStore {
public:
	TableStore(Decoder *);
	~TableStore();

#if PsiTable_CONSTRUCTORTEMPLATE
	bool add(uint8_t, PsiTable, TableWatcher* watcher = NULL);

	template<typename T>
	bool add(uint8_t tableid, T* p_table, TableWatcher* watcher = NULL)
	{
		return add(tableid, PsiTable(p_table), watcher);
	}
#else
	bool add(uint8_t, PsiTable&, TableWatcher* watcher = NULL);

	template<typename T>
	bool add(uint8_t tableid, T* p_table, TableWatcher* watcher = NULL)
	{
		PsiTable psiTable;
		psiTable.Set<T>(p_table);
		return add(tableid, psiTable, watcher);
	}
#endif
<commit_msg>decode/table: clean up PsiTable::[GS]et() whitespace<commit_after>/*****************************************************************************
 * Copyright (C) 2011-2015 <NAME>
 *
 * Author: <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *****************************************************************************/

#ifndef __TABLE_H__
#define __TABLE_H__

#include <string>

#include "decode/decoder.h"
#include "decode/descriptor/descriptor.h"

namespace dvbtee {

namespace decode {


class TableWatcher;

class TableBase: public Decoder {
public:
	const uint8_t& getTableid() const;
	void reset();

protected:
	TableBase(Decoder*, std::string&, uint8_t, TableWatcher*);
	virtual ~TableBase();

	TableWatcher *m_watcher;

	DescriptorStore descriptors;

private:
	const uint8_t m_tableid;

	void init();
};

class Table: public TableBase {
public:
	Table(Decoder*, std::string&, uint8_t, TableWatcher*);
	virtual ~Table();
};

class TableWatcher {
public:
	TableWatcher() {}
	virtual ~TableWatcher() {}

	virtual void updateTable(uint8_t tId, Table*) = 0;
};

class TableDataComponent: public LinkedDecoder {
public:
	TableDataComponent(Decoder*, std::string&);
	virtual ~TableDataComponent();

	DescriptorStore descriptors;
};

#define PsiTable_CONSTRUCTORTEMPLATE 0
struct PsiTable {
#if PsiTable_CONSTRUCTORTEMPLATE
    PsiTable(const PsiTable& o) : m_priv(o.m_priv) { }

    template<typename T> PsiTable(const T* p) : m_priv(p) { }
#else
    PsiTable() : m_priv(NULL) { }

    template<typename T> void Set(const T* p)
    {
        m_priv = p;
    }
#endif
    template<typename T> const T* Get() const
    {
        return (!m_priv) ? NULL : ((T*)m_priv);
    }
private:
    const void *m_priv;
};

class TableStore {
public:
	TableStore(Decoder *);
	~TableStore();

#if PsiTable_CONSTRUCTORTEMPLATE
	bool add(uint8_t, PsiTable, TableWatcher* watcher = NULL);

	template<typename T>
	bool add(uint8_t tableid, T* p_table, TableWatcher* watcher = NULL)
	{
		return add(tableid, PsiTable(p_table), watcher);
	}
#else
	bool add(uint8_t, PsiTable&, TableWatcher* watcher = NULL);

	template<typename T>
	bool add(uint8_t tableid, T* p_table, TableWatcher* watcher = NULL)
	{
		PsiTable psiTable;
		psiTable.Set<T>(p_table);
		return add(tableid, psiTable, watcher);
	}
#endif

{'fraction_non_alphanumeric': 0.15436467812605326, 'fraction_numerical': 0.010785305021907651, 'mean_word_length': 4.940940940940941, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1530733', 'n_tokens_mistral': 1942, 'n_tokens_neox': 1851, 'n_words': 598}