+Runtime::Runtime()
+{
+ DEBTRACE("Runtime::Runtime");
+ Runtime::_tc_double = new TypeCode(Double);
+ Runtime::_tc_int = new TypeCode(Int);
+ Runtime::_tc_bool = new TypeCode(Bool);
+ Runtime::_tc_string = new TypeCode(String);
+ Runtime::_tc_file = new TypeCodeObjref("file", "file");
+ TypeCodeStruct * stringpair = new TypeCodeStruct("stringpair", "stringpair");
+ stringpair->addMember("name", Runtime::_tc_string);
+ stringpair->addMember("value", Runtime::_tc_string);
+ Runtime::_tc_stringpair = stringpair;
+ Runtime::_tc_propvec = new TypeCodeSeq("propvec", "propvec", Runtime::_tc_stringpair);
+ DEBTRACE( "_tc_double refcnt: " << Runtime::_tc_double->getRefCnt() );
+ DEBTRACE( "_tc_int refcnt: " << Runtime::_tc_int->getRefCnt() );
+ DEBTRACE( "_tc_bool refcnt: " << Runtime::_tc_bool->getRefCnt() );
+ DEBTRACE( "_tc_string refcnt: " << Runtime::_tc_string->getRefCnt() );
+ DEBTRACE( "_tc_file refcnt: " << Runtime::_tc_file->getRefCnt() );
+ DEBTRACE( "_tc_stringpair refcnt: " << Runtime::_tc_stringpair->getRefCnt() );
+ DEBTRACE( "_tc_propvec refcnt: " << Runtime::_tc_propvec->getRefCnt() );
+ _builtinCatalog = new Catalog("builtins");
+ std::map<std::string,TypeCode*>& typeMap=_builtinCatalog->_typeMap;
+ /* All composed node creations are moved to RuntimeSALOME::initBuiltins.
+ It is not safe to have all those calls to virtual functions (create*)
+ in the constructor. */
+ Runtime::_tc_double->incrRef();
+ typeMap["double"]=Runtime::_tc_double;
+ Runtime::_tc_int->incrRef();
+ typeMap["int"]=Runtime::_tc_int;
+ Runtime::_tc_bool->incrRef();
+ typeMap["bool"]=Runtime::_tc_bool;
+ Runtime::_tc_string->incrRef();
+ typeMap["string"]=Runtime::_tc_string;
+ Runtime::_tc_file->incrRef();
+ typeMap["file"]=Runtime::_tc_file;
+ Runtime::_tc_stringpair->incrRef();
+ typeMap["stringpair"]=Runtime::_tc_stringpair;
+ Runtime::_tc_propvec->incrRef();
+ typeMap["propvec"]=Runtime::_tc_propvec;
+
+ // Get dynamic trace level
+ YACS::traceLevel=0;
+ char* valenv=getenv("YACS_TRACELEVEL");
+ if(valenv)
+ {
+ std::istringstream iss(valenv);
+ int temp;
+ if (iss >> temp)
+ YACS::traceLevel=temp;
+ }
+
+ // Get max threads number
+ char *maxThreadStr = getenv("YACS_MAX_THREADS");
+ if (maxThreadStr != NULL)
+ {
+ int maxThreads = atoi(maxThreadStr);
+ DEBTRACE("maxThreads = " << maxThreads);
+ if (maxThreads > 0) Executor::_maxThreads = maxThreads;
+ }
+
+ // Get thread stack size
+ char *threadStackSizeStr = getenv("YACS_THREADS_STACK_SIZE");
+ if (threadStackSizeStr != NULL)
+ {
+ size_t threadStackSize = strtoul(threadStackSizeStr, NULL, 0);
+ DEBTRACE("threadStackSize = " << threadStackSize);
+ if (threadStackSize > 0) Executor::_threadStackSize = threadStackSize;
+ }
+}
+
+void Runtime::removeRuntime()
+{
+ delete this;
+}
+