facebook/osquery — pull request #515 by theopolis (2014-12-03 04:39:57+00:00)
Title: Towards simple table generation

Prefer simple generate code, hopefully a single struct/class combo.

Exmaple:
```cpp
// Copyright 2004-present Facebook. All Rights Reserved.

/*
** This file is generated. Do not modify it manually!
*/

#include "osquery/tables.h"
#include "osquery/core/virtual_table.h"

namespace osquery { namespace tables {

osquery::QueryData genArpCache(QueryContext& request);

struct osquery_table_arp_cache : virtual osquery_table {
TableName name = "arp_cache";
TableTypes types = {
"TEXT",
"TEXT",
"TEXT",
"TEXT"
};
TableColumns column_names = {
"address",
"mac",
"interface",
"permanent"
};

QueryData generate(QueryContext& request) {
return osquery::tables::genArpCache(request);
}
};

class arpCacheTablePlugin : public TablePlugin {
public:
arpCacheTablePlugin() {}
int attachVtable(sqlite3 *db) {
return sqlite3_attach_vtable(db,
"arp_cache");
}
virtual ~arpCacheTablePlugin() {}
};

REGISTER_TABLE(
"arp_cache",
std::make_shared()
);

}}
```