]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.databoard/cpp/DataBoardTest/DataBoardTest/main.cpp
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / DataBoardTest / main.cpp
index f6fdef8bf8c9dc6d02b87e349307fe74b2f5eef6..f314ea240f8fe5628c3baca71050a375f3909596 100644 (file)
-#ifdef _WIN32\r
-#include <Windows.h>\r
-#include "StackWalker.h"\r
-#endif\r
-\r
-#include "TypeParser.h"\r
-#include "ValueParser.h"\r
-\r
-#include "DataBoardRepository.h"\r
-#include "DataValueRepository.h"\r
-\r
-#include "RecordType.h"\r
-#include "Component.h"\r
-\r
-#include "RecordValue.h"\r
-#include "StringValue.h"\r
-#include "IntegerValue.h"\r
-#include "DoubleValue.h"\r
-#include "ArrayValue.h"\r
-\r
-#include "MapValue.h"\r
-#include "IntegerType.h"\r
-#include "StringType.h"\r
-#include "DataType.h"\r
-\r
-\r
-#include "NumberType.h"\r
-\r
-#include <iostream>\r
-\r
-\r
-\r
-void testParser()\r
-{\r
-       std::cout << "Output of dbt & dbv files:" << std::endl;\r
-\r
-       Databoard::Type::DataBoardRepository* typeRepo = Databoard::Type::parse("input11.dbt");\r
-\r
-       if(typeRepo == NULL)\r
-       {\r
-               std::cerr << "type repository not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       Databoard::Type::DataType* type = typeRepo->getDataBoard("PBEparticle");\r
-\r
-       if(type == NULL)\r
-       {\r
-               std::cerr << "type not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       Databoard::Value::Value* value = Databoard::Value::parse("input12.dbv", type);\r
-\r
-       if(value == NULL)\r
-       {\r
-               std::cerr << "value not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       //Databoard::Type::RecordType* r = ((Databoard::Type::RecordType*)type);\r
-\r
-       //std::cout << r->getComponentIndex("FractalIndex") << std::endl;\r
-       //std::cout << r->getComponentIndex("Bondforce") << std::endl;\r
-       //std::cout << r->getComponentIndex("Density") << std::endl;\r
-       //std::cout << r->getComponentIndex("RefractiveIndex") << std::endl;\r
-       //std::cout << r->getComponentIndex("UVabsorption") << std::endl;\r
-       //std::cout << r->getComponentIndex("SurfacePotential") << std::endl;\r
-       //std::cout << r->getComponentIndex("SurfaceCharge") << std::endl;\r
-       //std::cout << r->getComponentIndex("RPermittivity") << std::endl;\r
-       //std::cout << r->getComponentIndex("AvgRadius") << std::endl;\r
-\r
-       //Databoard::Value::RecordValue* t = ((Databoard::Value::RecordValue*)value);\r
-\r
-       //Databoard::Value::DoubleValue* f0 = (Databoard::Value::DoubleValue*)t->getField(0);\r
-       //Databoard::Value::DoubleValue* f1 = (Databoard::Value::DoubleValue*)t->getField(1);\r
-       //Databoard::Value::DoubleValue* f2 = (Databoard::Value::DoubleValue*)t->getField(2);\r
-       //Databoard::Value::DoubleValue* f3 = (Databoard::Value::DoubleValue*)t->getField(3);\r
-       //Databoard::Value::RecordValue* f4 = (Databoard::Value::RecordValue*)t->getField(4);\r
-       //Databoard::Value::DoubleValue* f5 = (Databoard::Value::DoubleValue*)t->getField(5);\r
-       //Databoard::Value::DoubleValue* f6 = (Databoard::Value::DoubleValue*)t->getField(6);\r
-       //Databoard::Value::DoubleValue* f7 = (Databoard::Value::DoubleValue*)t->getField(7);\r
-       //Databoard::Value::DoubleValue* f8 = (Databoard::Value::DoubleValue*)t->getField(8);\r
-\r
-       //std::cout << f0->getValue() << std::endl;\r
-       //std::cout << f1->getValue() << std::endl;\r
-       //std::cout << f2->getValue() << std::endl;\r
-       //std::cout << f3->getValue() << std::endl;\r
-\r
-       //std::cout << ((Databoard::Value::DoubleValue*)f4->getField(0))->getValue() << std::endl;\r
-       //std::cout << ((Databoard::Value::DoubleValue*)f4->getField(1))->getValue() << std::endl;\r
-\r
-       //std::cout << f5->getValue() << std::endl;\r
-       //std::cout << f6->getValue() << std::endl;\r
-       //std::cout << f7->getValue() << std::endl;\r
-       //std::cout << f8->getValue() << std::endl;\r
-\r
-       std::cout << type->writeOut() << std::endl;\r
-       std::cout << value->writeOut() << std::endl;\r
-\r
-       delete value;\r
-       delete typeRepo;\r
-\r
-       std::cout << "..." << std::endl;\r
-}\r
-\r
-void testParser2()\r
-{\r
-       std::cout << "Output of dbt & dbd(s) files:" << std::endl;\r
-\r
-       Databoard::Type::DataBoardRepository* typeRepo = Databoard::Type::parse("input23.dbt");\r
-\r
-       if(typeRepo == NULL)\r
-       {\r
-               std::cerr << "type repository not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       Databoard::Value::DataValueRepository* valueRepo = NULL;\r
-       Databoard::Value::parse("input24_1.dbd", valueRepo, typeRepo);\r
-       Databoard::Value::parse("input24_2.dbd", valueRepo, typeRepo);\r
-\r
-       const Databoard::Value::strDataValueDefinition* v1 = valueRepo->getDataValue("a");\r
-       const Databoard::Value::strDataValueDefinition* v2 = valueRepo->getDataValue("b");\r
-\r
-       std::cout << "... printing types:" << std::endl;\r
-\r
-       for(int i = 0; i < typeRepo->count(); ++i)\r
-       {\r
-               std::cout << "#" << i << ":" << std::endl;\r
-\r
-               std::cout << typeRepo->getDataBoard(i).writeOut() << std::endl << std::endl;\r
-       }\r
-\r
-       if(v1 != NULL)\r
-       {\r
-               std::cout << "... printing value definition:" << std::endl;\r
-\r
-               std::cout << v1->writeOut() << std::endl;\r
-\r
-               std::string v = v1->value->isValid();\r
-\r
-               if(v.length() > 0)\r
-               {\r
-                       std::cout << "type is invalid: " << v << std::endl;\r
-               }\r
-               else\r
-               {\r
-                       std::cout << "type is valid" << std::endl;\r
-               }\r
-       }\r
-\r
-       if(v2 != NULL)\r
-       {\r
-               std::cout << "... printing value definition:" << std::endl;\r
-\r
-               std::cout << v2->writeOut() << std::endl;\r
-\r
-               std::string v = v2->value->isValid();\r
-\r
-               if(v.length() > 0)\r
-               {\r
-                       std::cout << "type is invalid: " << v << std::endl;\r
-               }\r
-               else\r
-               {\r
-                       std::cout << "type is valid" << std::endl;\r
-               }\r
-       }\r
-\r
-\r
-       Databoard::Value::free(valueRepo);\r
-       Databoard::Type::free(typeRepo);\r
-\r
-       std::cout << "..." << std::endl;\r
-\r
-}\r
-\r
-void testParser3()\r
-{\r
-       std::cout << "Output of dbt file:" << std::endl;\r
-\r
-       Databoard::Type::DataBoardRepository* typeRepo = Databoard::Type::parse("input17.dbt");\r
-\r
-       Databoard::Type::DataType* type = typeRepo->getDataBoard("Complex");\r
-\r
-       if(type == NULL)\r
-       {\r
-               std::cerr << "type not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       std::cout << type->writeOut() << std::endl;\r
-\r
-       Databoard::Value::MapValue* mapValue = new Databoard::Value::MapValue(type);\r
-\r
-       Databoard::Type::IntegerType* integerType = new Databoard::Type::IntegerType();\r
-       Databoard::Type::StringType* stringType = new Databoard::Type::StringType();\r
-\r
-       Databoard::Value::IntegerValue* k0 = new Databoard::Value::IntegerValue(integerType);\r
-       Databoard::Value::IntegerValue* k1 = new Databoard::Value::IntegerValue(integerType);\r
-       Databoard::Value::IntegerValue* k2 = new Databoard::Value::IntegerValue(integerType);\r
-       Databoard::Value::IntegerValue* k3 = new Databoard::Value::IntegerValue(integerType);\r
-\r
-       Databoard::Value::StringValue* v0 = new Databoard::Value::StringValue(stringType);\r
-       Databoard::Value::StringValue* v1 = new Databoard::Value::StringValue(stringType);\r
-       Databoard::Value::StringValue* v2 = new Databoard::Value::StringValue(stringType);\r
-       Databoard::Value::StringValue* v3 = new Databoard::Value::StringValue(stringType);\r
-\r
-       k0->setValue(2);\r
-       k1->setValue(4);\r
-       k2->setValue(8);\r
-       k3->setValue(5);\r
-\r
-       v0->setValue("asd0");\r
-       v1->setValue("asd1");\r
-       v2->setValue("asd2");\r
-       v3->setValue("asd3");\r
-\r
-       std::cout << "mappi:" << std::endl << mapValue->writeOut() << std::endl;\r
-       mapValue->put(k0, v0);\r
-\r
-       std::cout << "mappi:" << std::endl << mapValue->writeOut() << std::endl;\r
-       mapValue->put(k1, v1);\r
-\r
-       std::cout << "mappi:" << std::endl << mapValue->writeOut() << std::endl;\r
-       mapValue->put(k2, v2);\r
-\r
-       std::cout << "mappi:" << std::endl << mapValue->writeOut() << std::endl;\r
-       mapValue->put(k3, v3);\r
-\r
-       mapValue->removeRange(k0, k1);\r
-\r
-       //Databoard::Value::Value* old = mapValue->remove(k0);\r
-\r
-       //delete k0;\r
-       //delete old;\r
-\r
-       delete mapValue;\r
-       delete integerType;\r
-       delete stringType;\r
-\r
-       Databoard::Type::free(typeRepo);\r
-}\r
-\r
-void testParser4()\r
-{\r
-       std::cout << "Output of dbt & dbv files:" << std::endl;\r
-\r
-       Databoard::Type::DataBoardRepository* typeRepo = Databoard::Type::parse("input25.dbt");\r
-\r
-       if(typeRepo == NULL)\r
-       {\r
-               std::cerr << "type repository not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       Databoard::Type::DataType* type = typeRepo->getDataBoard("AggreDist");\r
-\r
-       if(type == NULL)\r
-       {\r
-               std::cerr << "type not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       Databoard::Value::DataValueRepository* valueRepo = NULL;\r
-       Databoard::Value::parse("input26_3.dbd", valueRepo, typeRepo);\r
-\r
-       Databoard::Value::Value* value1 = Databoard::Value::parse("input26_1.dbv", type);\r
-\r
-       if(value1 == NULL)\r
-       {\r
-               std::cerr << "value not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       Databoard::Value::Value* value2 = Databoard::Value::parse("input26_2.dbv", type);\r
-\r
-       if(value2 == NULL)\r
-       {\r
-               std::cerr << "value not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       if(value1 != NULL)\r
-       {\r
-               std::cout << "... printing value definition:" << std::endl;\r
-\r
-               std::cout << value1->writeOut() << std::endl;\r
-\r
-               std::string v = value1->isValid();\r
-\r
-               if(v.length() > 0)\r
-               {\r
-                       std::cout << "type is invalid: " << v << std::endl;\r
-               }\r
-               else\r
-               {\r
-                       std::cout << "type is valid" << std::endl;\r
-               }\r
-\r
-               delete value1;\r
-       }\r
-\r
-       if(value2 != NULL)\r
-       {\r
-               std::cout << "... printing value definition:" << std::endl;\r
-\r
-               std::cout << value2->writeOut() << std::endl;\r
-\r
-               std::string v = value2->isValid();\r
-\r
-               if(v.length() > 0)\r
-               {\r
-                       std::cout << "type is invalid: " << v << std::endl;\r
-               }\r
-               else\r
-               {\r
-                       std::cout << "type is valid" << std::endl;\r
-               }\r
-\r
-               delete value2;\r
-       }\r
-\r
-       delete valueRepo;\r
-       delete typeRepo;\r
-\r
-       std::cout << "..." << std::endl;\r
-}\r
-\r
-void testParser5()\r
-{\r
-       std::cout << "Output of dbt & dbv files:" << std::endl;\r
-\r
-       Databoard::Type::DataBoardRepository* typeRepo = Databoard::Type::parse("input27.dbt");\r
-\r
-       if(typeRepo == NULL)\r
-       {\r
-               std::cerr << "type repository not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       Databoard::Type::DataType* type = typeRepo->getDataBoard("Complex");\r
-\r
-       if(type == NULL)\r
-       {\r
-               std::cerr << "type not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       Databoard::Value::Value* value = Databoard::Value::parse("input28.dbv", type);\r
-\r
-       if(value == NULL)\r
-       {\r
-               std::cerr << "value not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       std::cout << type->writeOut() << std::endl;\r
-       std::cout << value->writeOut() << std::endl;\r
-\r
-       delete value;\r
-       delete typeRepo;\r
-\r
-       std::cout << "..." << std::endl;\r
-}\r
-\r
-void testParser6()\r
-{\r
-       std::cout << "Output of dbt & dbv files:" << std::endl;\r
-\r
-       Databoard::Type::DataBoardRepository* typeRepo = Databoard::Type::parse("input29.dbt");\r
-\r
-       if(typeRepo == NULL)\r
-       {\r
-               std::cerr << "type repository not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       Databoard::Type::DataType* type = typeRepo->getDataBoard("T");\r
-\r
-       if(type == NULL)\r
-       {\r
-               std::cerr << "type not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       Databoard::Value::Value* value1 = Databoard::Value::parse("input30.dbv", type);\r
-\r
-       if(value1 == NULL)\r
-       {\r
-               std::cerr << "value not found" << std::endl;\r
-\r
-               return;\r
-       }\r
-\r
-       Databoard::Value::RecordValue* recordValue = dynamic_cast<Databoard::Value::RecordValue*>(value1);\r
-\r
-       if(recordValue != NULL)\r
-       {\r
-               for(int i = 0; i < recordValue->count(); ++i)\r
-               {\r
-                       Databoard::Value::Value* value = recordValue->getField(i);\r
-\r
-                       Databoard::Value::ArrayValue* arrayValue = dynamic_cast<Databoard::Value::ArrayValue*>(value);\r
-\r
-                       if(arrayValue != NULL)\r
-                       {\r
-                               //// one by one:\r
-                               //for(int j = 0; j < arrayValue->count(); ++j)\r
-                               //{\r
-                               //      Databoard::Value::Value* value = arrayValue->get(j);\r
-\r
-                               //      std::cout << value->writeOut() << std::endl;\r
-                               //}\r
-\r
-                               // or to vector:\r
-                               std::vector<Databoard::Value::Value*> valueVector = arrayValue->getAll();\r
-\r
-                               std::cout << "Row count: " << (int)valueVector.size() << std::endl;\r
-\r
-                               for(int j = 0; j < (int)valueVector.size(); ++j)\r
-                               {\r
-                                       Databoard::Value::RecordValue* recordValue = (Databoard::Value::RecordValue*)valueVector.at(j);\r
-\r
-                                       std::cout << "Element count: " << recordValue->count() << std::endl;\r
-\r
-                                       for(int k = 0; k < recordValue->count(); ++k)\r
-                                       {\r
-                                               Databoard::Value::DoubleValue* doubleValue = (Databoard::Value::DoubleValue*)recordValue->getField(k);\r
-\r
-                                               std::cout << doubleValue->getValue() << std::endl;\r
-                                               \r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-\r
-               delete value1;\r
-       }\r
-\r
-       delete typeRepo;\r
-\r
-       std::cout << "..." << std::endl;\r
-}\r
-\r
-\r
-int main()\r
-{\r
-#ifdef _WIN32\r
-       InitAllocCheck();\r
-#endif\r
-\r
-       //testParser();\r
-       //testParser2();\r
-       //testParser3();\r
-       //testParser4();\r
-       //testParser5();\r
-       testParser6();\r
-\r
-#ifdef _WIN32\r
-       DeInitAllocCheck();\r
-#endif\r
-}\r
+#ifdef _WIN32
+#include <Windows.h>
+#include "StackWalker.h"
+#endif
+
+#include "TypeParser.h"
+#include "ValueParser.h"
+
+#include "DataBoardRepository.h"
+#include "DataValueRepository.h"
+
+#include "RecordType.h"
+#include "Component.h"
+
+#include "RecordValue.h"
+#include "StringValue.h"
+#include "IntegerValue.h"
+#include "DoubleValue.h"
+#include "ArrayValue.h"
+
+#include "MapValue.h"
+#include "IntegerType.h"
+#include "StringType.h"
+#include "DataType.h"
+
+
+#include "NumberType.h"
+
+#include <iostream>
+
+
+
+void testParser()
+{
+       std::cout << "Output of dbt & dbv files:" << std::endl;
+
+       Databoard::Type::DataBoardRepository* typeRepo = Databoard::Type::parse("input11.dbt");
+
+       if(typeRepo == NULL)
+       {
+               std::cerr << "type repository not found" << std::endl;
+
+               return;
+       }
+
+       Databoard::Type::DataType* type = typeRepo->getDataBoard("PBEparticle");
+
+       if(type == NULL)
+       {
+               std::cerr << "type not found" << std::endl;
+
+               return;
+       }
+
+       Databoard::Value::Value* value = Databoard::Value::parse("input12.dbv", type);
+
+       if(value == NULL)
+       {
+               std::cerr << "value not found" << std::endl;
+
+               return;
+       }
+
+       //Databoard::Type::RecordType* r = ((Databoard::Type::RecordType*)type);
+
+       //std::cout << r->getComponentIndex("FractalIndex") << std::endl;
+       //std::cout << r->getComponentIndex("Bondforce") << std::endl;
+       //std::cout << r->getComponentIndex("Density") << std::endl;
+       //std::cout << r->getComponentIndex("RefractiveIndex") << std::endl;
+       //std::cout << r->getComponentIndex("UVabsorption") << std::endl;
+       //std::cout << r->getComponentIndex("SurfacePotential") << std::endl;
+       //std::cout << r->getComponentIndex("SurfaceCharge") << std::endl;
+       //std::cout << r->getComponentIndex("RPermittivity") << std::endl;
+       //std::cout << r->getComponentIndex("AvgRadius") << std::endl;
+
+       //Databoard::Value::RecordValue* t = ((Databoard::Value::RecordValue*)value);
+
+       //Databoard::Value::DoubleValue* f0 = (Databoard::Value::DoubleValue*)t->getField(0);
+       //Databoard::Value::DoubleValue* f1 = (Databoard::Value::DoubleValue*)t->getField(1);
+       //Databoard::Value::DoubleValue* f2 = (Databoard::Value::DoubleValue*)t->getField(2);
+       //Databoard::Value::DoubleValue* f3 = (Databoard::Value::DoubleValue*)t->getField(3);
+       //Databoard::Value::RecordValue* f4 = (Databoard::Value::RecordValue*)t->getField(4);
+       //Databoard::Value::DoubleValue* f5 = (Databoard::Value::DoubleValue*)t->getField(5);
+       //Databoard::Value::DoubleValue* f6 = (Databoard::Value::DoubleValue*)t->getField(6);
+       //Databoard::Value::DoubleValue* f7 = (Databoard::Value::DoubleValue*)t->getField(7);
+       //Databoard::Value::DoubleValue* f8 = (Databoard::Value::DoubleValue*)t->getField(8);
+
+       //std::cout << f0->getValue() << std::endl;
+       //std::cout << f1->getValue() << std::endl;
+       //std::cout << f2->getValue() << std::endl;
+       //std::cout << f3->getValue() << std::endl;
+
+       //std::cout << ((Databoard::Value::DoubleValue*)f4->getField(0))->getValue() << std::endl;
+       //std::cout << ((Databoard::Value::DoubleValue*)f4->getField(1))->getValue() << std::endl;
+
+       //std::cout << f5->getValue() << std::endl;
+       //std::cout << f6->getValue() << std::endl;
+       //std::cout << f7->getValue() << std::endl;
+       //std::cout << f8->getValue() << std::endl;
+
+       std::cout << type->writeOut() << std::endl;
+       std::cout << value->writeOut() << std::endl;
+
+       delete value;
+       delete typeRepo;
+
+       std::cout << "..." << std::endl;
+}
+
+void testParser2()
+{
+       std::cout << "Output of dbt & dbd(s) files:" << std::endl;
+
+       Databoard::Type::DataBoardRepository* typeRepo = Databoard::Type::parse("input23.dbt");
+
+       if(typeRepo == NULL)
+       {
+               std::cerr << "type repository not found" << std::endl;
+
+               return;
+       }
+
+       Databoard::Value::DataValueRepository* valueRepo = NULL;
+       Databoard::Value::parse("input24_1.dbd", valueRepo, typeRepo);
+       Databoard::Value::parse("input24_2.dbd", valueRepo, typeRepo);
+
+       const Databoard::Value::strDataValueDefinition* v1 = valueRepo->getDataValue("a");
+       const Databoard::Value::strDataValueDefinition* v2 = valueRepo->getDataValue("b");
+
+       std::cout << "... printing types:" << std::endl;
+
+       for(int i = 0; i < typeRepo->count(); ++i)
+       {
+               std::cout << "#" << i << ":" << std::endl;
+
+               std::cout << typeRepo->getDataBoard(i).writeOut() << std::endl << std::endl;
+       }
+
+       if(v1 != NULL)
+       {
+               std::cout << "... printing value definition:" << std::endl;
+
+               std::cout << v1->writeOut() << std::endl;
+
+               std::string v = v1->value->isValid();
+
+               if(v.length() > 0)
+               {
+                       std::cout << "type is invalid: " << v << std::endl;
+               }
+               else
+               {
+                       std::cout << "type is valid" << std::endl;
+               }
+       }
+
+       if(v2 != NULL)
+       {
+               std::cout << "... printing value definition:" << std::endl;
+
+               std::cout << v2->writeOut() << std::endl;
+
+               std::string v = v2->value->isValid();
+
+               if(v.length() > 0)
+               {
+                       std::cout << "type is invalid: " << v << std::endl;
+               }
+               else
+               {
+                       std::cout << "type is valid" << std::endl;
+               }
+       }
+
+
+       Databoard::Value::free(valueRepo);
+       Databoard::Type::free(typeRepo);
+
+       std::cout << "..." << std::endl;
+
+}
+
+void testParser3()
+{
+       std::cout << "Output of dbt file:" << std::endl;
+
+       Databoard::Type::DataBoardRepository* typeRepo = Databoard::Type::parse("input17.dbt");
+
+       Databoard::Type::DataType* type = typeRepo->getDataBoard("Complex");
+
+       if(type == NULL)
+       {
+               std::cerr << "type not found" << std::endl;
+
+               return;
+       }
+
+       std::cout << type->writeOut() << std::endl;
+
+       Databoard::Value::MapValue* mapValue = new Databoard::Value::MapValue(type);
+
+       Databoard::Type::IntegerType* integerType = new Databoard::Type::IntegerType();
+       Databoard::Type::StringType* stringType = new Databoard::Type::StringType();
+
+       Databoard::Value::IntegerValue* k0 = new Databoard::Value::IntegerValue(integerType);
+       Databoard::Value::IntegerValue* k1 = new Databoard::Value::IntegerValue(integerType);
+       Databoard::Value::IntegerValue* k2 = new Databoard::Value::IntegerValue(integerType);
+       Databoard::Value::IntegerValue* k3 = new Databoard::Value::IntegerValue(integerType);
+
+       Databoard::Value::StringValue* v0 = new Databoard::Value::StringValue(stringType);
+       Databoard::Value::StringValue* v1 = new Databoard::Value::StringValue(stringType);
+       Databoard::Value::StringValue* v2 = new Databoard::Value::StringValue(stringType);
+       Databoard::Value::StringValue* v3 = new Databoard::Value::StringValue(stringType);
+
+       k0->setValue(2);
+       k1->setValue(4);
+       k2->setValue(8);
+       k3->setValue(5);
+
+       v0->setValue("asd0");
+       v1->setValue("asd1");
+       v2->setValue("asd2");
+       v3->setValue("asd3");
+
+       std::cout << "mappi:" << std::endl << mapValue->writeOut() << std::endl;
+       mapValue->put(k0, v0);
+
+       std::cout << "mappi:" << std::endl << mapValue->writeOut() << std::endl;
+       mapValue->put(k1, v1);
+
+       std::cout << "mappi:" << std::endl << mapValue->writeOut() << std::endl;
+       mapValue->put(k2, v2);
+
+       std::cout << "mappi:" << std::endl << mapValue->writeOut() << std::endl;
+       mapValue->put(k3, v3);
+
+       mapValue->removeRange(k0, k1);
+
+       //Databoard::Value::Value* old = mapValue->remove(k0);
+
+       //delete k0;
+       //delete old;
+
+       delete mapValue;
+       delete integerType;
+       delete stringType;
+
+       Databoard::Type::free(typeRepo);
+}
+
+void testParser4()
+{
+       std::cout << "Output of dbt & dbv files:" << std::endl;
+
+       Databoard::Type::DataBoardRepository* typeRepo = Databoard::Type::parse("input25.dbt");
+
+       if(typeRepo == NULL)
+       {
+               std::cerr << "type repository not found" << std::endl;
+
+               return;
+       }
+
+       Databoard::Type::DataType* type = typeRepo->getDataBoard("AggreDist");
+
+       if(type == NULL)
+       {
+               std::cerr << "type not found" << std::endl;
+
+               return;
+       }
+
+       Databoard::Value::DataValueRepository* valueRepo = NULL;
+       Databoard::Value::parse("input26_3.dbd", valueRepo, typeRepo);
+
+       Databoard::Value::Value* value1 = Databoard::Value::parse("input26_1.dbv", type);
+
+       if(value1 == NULL)
+       {
+               std::cerr << "value not found" << std::endl;
+
+               return;
+       }
+
+       Databoard::Value::Value* value2 = Databoard::Value::parse("input26_2.dbv", type);
+
+       if(value2 == NULL)
+       {
+               std::cerr << "value not found" << std::endl;
+
+               return;
+       }
+
+       if(value1 != NULL)
+       {
+               std::cout << "... printing value definition:" << std::endl;
+
+               std::cout << value1->writeOut() << std::endl;
+
+               std::string v = value1->isValid();
+
+               if(v.length() > 0)
+               {
+                       std::cout << "type is invalid: " << v << std::endl;
+               }
+               else
+               {
+                       std::cout << "type is valid" << std::endl;
+               }
+
+               delete value1;
+       }
+
+       if(value2 != NULL)
+       {
+               std::cout << "... printing value definition:" << std::endl;
+
+               std::cout << value2->writeOut() << std::endl;
+
+               std::string v = value2->isValid();
+
+               if(v.length() > 0)
+               {
+                       std::cout << "type is invalid: " << v << std::endl;
+               }
+               else
+               {
+                       std::cout << "type is valid" << std::endl;
+               }
+
+               delete value2;
+       }
+
+       delete valueRepo;
+       delete typeRepo;
+
+       std::cout << "..." << std::endl;
+}
+
+void testParser5()
+{
+       std::cout << "Output of dbt & dbv files:" << std::endl;
+
+       Databoard::Type::DataBoardRepository* typeRepo = Databoard::Type::parse("input27.dbt");
+
+       if(typeRepo == NULL)
+       {
+               std::cerr << "type repository not found" << std::endl;
+
+               return;
+       }
+
+       Databoard::Type::DataType* type = typeRepo->getDataBoard("Complex");
+
+       if(type == NULL)
+       {
+               std::cerr << "type not found" << std::endl;
+
+               return;
+       }
+
+       Databoard::Value::Value* value = Databoard::Value::parse("input28.dbv", type);
+
+       if(value == NULL)
+       {
+               std::cerr << "value not found" << std::endl;
+
+               return;
+       }
+
+       std::cout << type->writeOut() << std::endl;
+       std::cout << value->writeOut() << std::endl;
+
+       delete value;
+       delete typeRepo;
+
+       std::cout << "..." << std::endl;
+}
+
+void testParser6()
+{
+       std::cout << "Output of dbt & dbv files:" << std::endl;
+
+       Databoard::Type::DataBoardRepository* typeRepo = Databoard::Type::parse("input29.dbt");
+
+       if(typeRepo == NULL)
+       {
+               std::cerr << "type repository not found" << std::endl;
+
+               return;
+       }
+
+       Databoard::Type::DataType* type = typeRepo->getDataBoard("T");
+
+       if(type == NULL)
+       {
+               std::cerr << "type not found" << std::endl;
+
+               return;
+       }
+
+       Databoard::Value::Value* value1 = Databoard::Value::parse("input30.dbv", type);
+
+       if(value1 == NULL)
+       {
+               std::cerr << "value not found" << std::endl;
+
+               return;
+       }
+
+       Databoard::Value::RecordValue* recordValue = dynamic_cast<Databoard::Value::RecordValue*>(value1);
+
+       if(recordValue != NULL)
+       {
+               for(int i = 0; i < recordValue->count(); ++i)
+               {
+                       Databoard::Value::Value* value = recordValue->getField(i);
+
+                       Databoard::Value::ArrayValue* arrayValue = dynamic_cast<Databoard::Value::ArrayValue*>(value);
+
+                       if(arrayValue != NULL)
+                       {
+                               //// one by one:
+                               //for(int j = 0; j < arrayValue->count(); ++j)
+                               //{
+                               //      Databoard::Value::Value* value = arrayValue->get(j);
+
+                               //      std::cout << value->writeOut() << std::endl;
+                               //}
+
+                               // or to vector:
+                               std::vector<Databoard::Value::Value*> valueVector = arrayValue->getAll();
+
+                               std::cout << "Row count: " << (int)valueVector.size() << std::endl;
+
+                               for(int j = 0; j < (int)valueVector.size(); ++j)
+                               {
+                                       Databoard::Value::RecordValue* recordValue = (Databoard::Value::RecordValue*)valueVector.at(j);
+
+                                       std::cout << "Element count: " << recordValue->count() << std::endl;
+
+                                       for(int k = 0; k < recordValue->count(); ++k)
+                                       {
+                                               Databoard::Value::DoubleValue* doubleValue = (Databoard::Value::DoubleValue*)recordValue->getField(k);
+
+                                               std::cout << doubleValue->getValue() << std::endl;
+                                               
+                                       }
+                               }
+                       }
+               }
+
+               delete value1;
+       }
+
+       delete typeRepo;
+
+       std::cout << "..." << std::endl;
+}
+
+
+int main()
+{
+#ifdef _WIN32
+       InitAllocCheck();
+#endif
+
+       //testParser();
+       //testParser2();
+       //testParser3();
+       //testParser4();
+       //testParser5();
+       testParser6();
+
+#ifdef _WIN32
+       DeInitAllocCheck();
+#endif
+}