[Assorted-commits] SF.net SVN: assorted:[1304] ydb/trunk/src
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-03-18 09:59:32
|
Revision: 1304 http://assorted.svn.sourceforge.net/assorted/?rev=1304&view=rev Author: yangzhang Date: 2009-03-18 09:59:25 +0000 (Wed, 18 Mar 2009) Log Message: ----------- cleaned up macros, cog Modified Paths: -------------- ydb/trunk/src/ser.h ydb/trunk/src/tpcc/tpcctables.cc.cog Modified: ydb/trunk/src/ser.h =================================================================== --- ydb/trunk/src/ser.h 2009-03-18 09:58:41 UTC (rev 1303) +++ ydb/trunk/src/ser.h 2009-03-18 09:59:25 UTC (rev 1304) @@ -10,9 +10,6 @@ #include <iostream> #include "ydb.pb.h" -#define BEGIN_NAMESPACE(ns) namespace ns { -#define END_NAMESPACE } - #define MAKE_START_FIN_HELPER(MsgType, field, action) \ template<typename T> inline void action##_##field(T &msg); \ template<> inline void action##_##field(ydb::pb::MsgType&) {} \ Modified: ydb/trunk/src/tpcc/tpcctables.cc.cog =================================================================== --- ydb/trunk/src/tpcc/tpcctables.cc.cog 2009-03-18 09:58:41 UTC (rev 1303) +++ ydb/trunk/src/tpcc/tpcctables.cc.cog 2009-03-18 09:59:25 UTC (rev 1304) @@ -1,3 +1,13 @@ +//[[[cog +// allfields = 'items warehouses stock districts customers orders orderlines neworders history'.split() +// treepairs = 'warehouses/Warehouse stock/Stock districts/District customers/Customer orders/Order orderlines/OrderLine'.split() +// allpairs = treepairs + ['neworders/NewOrder'] +// def typedefs(): +// for name in allfields: +// cog.outl(r'typedef typeof(%s_) type_%s;' % (name, name)) +//]]] +//[[[end]]] + #include "tpcctables.h" #include <algorithm> @@ -605,7 +615,6 @@ using namespace std; cout //[[[cog - // import cog // for name in 'items warehouses stock districts customers orders orders_by_customer orderlines customers_by_name neworders history'.split(): // cog.outl(r'<< " |%s| = " << %s_.size() << "\n"' % (name, name)) //]]] @@ -625,11 +634,10 @@ bzero(&hdr, sizeof hdr); hdr.seqno = seqno; //[[[cog - // import cog - // for name in 'items warehouses stock districts customers orders orderlines neworders history'.split(): - // cog.outl(r'typedef typeof(%s_) type_%s;' % (name, name)) + // typedefs() + // for name in allfields: // cog.outl(r'hdr.n%s = uint32_t(%s_.size());' % (name, name)) - // for pair in 'warehouses/Warehouse stock/Stock districts/District customers/Customer orders/Order orderlines/OrderLine neworders/NewOrder'.split(): + // for pair in allpairs: // name, struct = pair.split('/') // cog.outl(r'hdr.len += uint32_t(hdr.n%s * (sizeof(type_%s::key_type) + sizeof(%s)));' % (name, name, struct)) //]]] @@ -651,7 +659,7 @@ } //[[[cog - // for pair in 'warehouses/Warehouse stock/Stock districts/District customers/Customer orders/Order orderlines/OrderLine'.split(): + // for pair in treepairs: // name, struct = pair.split('/') // cog.outl(r''' // { @@ -691,19 +699,14 @@ raw_reader reader(arr.get()); - //[[[cog - // for name in 'items warehouses stock districts customers orders orderlines neworders history'.split(): - // cog.outl(r'typedef typeof(%s_) type_%s;' % (name, name)) - //]]] - //[[[end]]] - items_.reserve(hdr.nitems); for (uint32_t i = 0; i < hdr.nitems; ++i) { items_.push_back(reader.read<Item>()); } //[[[cog - // for pair in 'warehouses/Warehouse stock/Stock districts/District customers/Customer orders/Order orderlines/OrderLine'.split(): + // typedefs() + // for pair in treepairs: // name, struct = pair.split('/') // # Generate customers_by_name_ // cbn = r'customers_by_name_.insert(reinterpret_cast<Customer*>(reader.ptr()));' if name == 'customers' else '' @@ -730,7 +733,7 @@ history_.reserve(hdr.nhistory); for (uint32_t i = 0; i < hdr.nhistory; ++i) { - history_.push_back(reader.readptr<const History>()); // reinterpret_cast<const History*>(reader.ptr())); + history_.push_back(reader.readptr<const History>()); } serbuf_.reset(arr.get(), arr.size()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |