This is a C++ template class library for generic smart data.Smart data substitutes plain old data (in the smart pointers' manner), automatically generating associated: copy constructor, assignment operator, toString(), serialization, etc.
Be the first to post a text review of Smart data library. Rate and review a project by clicking thumbs up or thumbs down in the right column.
Smart Data Types proof of concept. Two samples compiled under Visual C++ 7.1 / g++
Please have a look on the project's slides at http://fratila.free.fr/sdtlib and write me if you're interested! Help wanted!
Compile-Time Visitor and Smart Data Types Manifest Hello! Come together! Before we begin, let me show you a tiny sample. After including two files, the main looks like this: --- // Execution data type definition typedef TFld<int, TObj > TNAMEDEF(TFExQty); typedef TFld<double, TFExQty> TNAMEDEF(TFExPrc); typedef TFld<long, TFExPrc> TNAMEDEF(TFExMkt); // Order data type definition typedef TFld<_STD string, TObj > TNAMEDEF(TFInstr); typedef TFld<int, TFInstr> TNAMEDEF(TFQuant); typedef TFld<double, TFQuant> TNAMEDEF(TFPrice); typedef TFld<long, TFPrice> TNAMEDEF(TFMktId); typedef TFld<bool, TFMktId> TNAMEDEF(TFIsBuy); typedef TFld<_STD set<int>, TFIsBuy> TNAMEDEF(TFClrId); typedef TFld<_STD set<TFExMkt>, TFClrId> TNAMEDEF(TFOrdEx); int main(int argc, char* argv[]) { // smart data object: order TFOrdEx o; // accessing field values o.ref<TFInstr>() = "PSFT.O"; o.ref<TFQuant>() = 1000; o.set<TFPrice>(25.05); // o.ref<TFPrice>() = 25.05; o.ref<TFMktId>() = 900101; o.ref<TFIsBuy>() = true; // accessing a set of integers o.ref<TFClrId>().insert(5); o.ref<TFClrId>().insert(9); TFExMkt e; // accessing a set of smart data objects: order executions e.ref<TFExQty>() = 100; e.ref<TFExPrc>() = 24.95; e.ref<TFExMkt>() = 500101; o.ref<TFOrdEx>().insert(e); e.ref<TFExQty>() = 500; e.ref<TFExPrc>() = 25.05; e.ref<TFExMkt>() = 500109; o.ref<TFOrdEx>().insert(e); print_visitor v; v(o); return 0; } --- entity TFOrdEx // (smart data type) { field TFInstr std::string PSFT.O field TFQuant int 1000 field TFPrice double 25.05 field TFMktId long 900101 field TFIsBuy bool 1 compo TFClrId std::set<int> { val int 5 // (primitive data type) val int 9 // (primitive data type) } // compo TFClrId compo TFOrdEx std::set<TFExMkt> { entity TFExMkt // (smart data type) { field TFExQty int 100 field TFExPrc double 24.95 field TFExMkt long 500101 } object @00325828; // TFExMkt entity TFExMkt // (smart data type) { field TFExQty int 500 field TFExPrc double 25.05 field TFExMkt long 500109 } object @00325888; // TFExMkt } // compo TFOrdEx } object @0012FF00; // TFOrdEx --- Welcome to smart data types world! Please, be kind with me, this is just the beginning... I promise you a helpful project, and we can do it together... Join the project, write with me... Or at least send me your feedback. Your opinions are important! What will this project do? First, propose a way of writing data classes (entities, should I say?), slightly enhancing POD. Second, visit each field of entities with a compile-time visitor. Slight abuse: use of veneers. These will shortly be visible in a proof of concept. Third, you will help me do some refactoring, then choose and code next steps. Steps I see now: A) POC (proof of concept), involving: A1) Naming helpers. A2) Smart data: Base class and Field wrappers. A3) Discussions: Field initialization; Inheritance. A4) Compile-time visitor sample: printout fields with names and values. A5) Referendum: your opinion on class names, next steps and priorities. B) Policy-based design exercise: Isolation of classes and responsibilities. C) Cosmetics! Lot of! D) Debugging and trace support. E) Integration with BOOST. F) Binary serialization standalone and/or with BOOST. G) XML serialization. Samples: FPML. H) Generating: XML entities description and DTD. I) Java format serialization. J) Object/relational mapping. K) Generating: IDL/WSDL; COM/CORBA/Web Services specificities. L) Similar mechanisms in: managed C++, C# with generics, then maybe Java. You may say Im a dreamer, but... Right, the scrollbar is still showing 0%, but were optimists and enthusiasts, arent we? Many thanks to all those who believe in the revolution of C++! Alexander Stepanov, Scott Meyers, Andrei Alexandrescu, Herb Sutter, Mathiew Wilson, David Abrahams, Aleksey Gurtovoy... Just a few here, theyre a lot... To my friend Greg Nomitch for all his advices... If youre reading this, youre one of them, so thank you! Dont let me down, I count on you! Lets go!
Copyright © 2009 Geeknet, Inc. All rights reserved. Terms of Use
Thanks for your rating!
Would you also like to write a review?