#include #include #include "JLang/JStorage.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" namespace { struct __A__ { __A__() { std::cout << "__A__()" << std::endl; } ~__A__() { std::cout << "~__A__()" << std::endl; } }; } /** * \file * * Example program to test JLANG::JStorage class. * \author mdejong */ int main(int argc, char **argv) { using namespace std; int debug; try { JParser<> zap("Example program to test creation and deletion of objects."); zap['d'] = make_field(debug) = 3; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } using namespace JPP; { cout << "JStorage" << endl; JStorage storage; storage.create(); *storage = 123.456; cout << *storage << endl; storage.reset(); } { cout << "JStorage<__A__>" << endl; JStorage<__A__> storage; for (int i = 0; i != 4; ++i) { cout << i << ' ' << "recreate()" << endl; storage.recreate(); } cout << "reset()" << endl; storage.reset(); } { cout << "JStorage<__A__, JNewCArray>" << endl; JStorage<__A__, JNewCArray> storage; cout << "reset()" << endl; storage.reset(); const int N = 2; cout << "create(" << N << ")" << endl; storage.create(N); cout << "reset()" << endl; storage.reset(); } }