DDS_StdString be_Type::EnclosingScopeString(AST_Decl * decl) { DDS_StdString ret; assert(decl); if (decl) { UTL_Scope * enclosingScope = decl->defined_in(); AST_Decl * enclosingDecl; if (enclosingScope) { if ((enclosingDecl = (AST_Decl*)enclosingScope->narrow((long) & AST_Decl::type_id))) { ret = NameToString(enclosingDecl->name(), 0); } else { DDSError((DDS_StdString)"Can't narrow enclosing scope for " + NameToString(decl->name(), 0)); } } } return ret; }
be_exception::be_exception (UTL_ScopedName *n, const UTL_Pragmas &p) : AST_Decl (AST_Decl::NT_except, n, p), UTL_Scope (AST_Decl::NT_except, n, p), AST_Structure (AST_Decl::NT_except, n, p), m_isFixedLength (TRUE), m_elemAlignment (0), m_elemSize (0), m_marshalInCore (false) { isAtModuleScope (pbfalse); const DDS_StdString userException = "DDS::UserException"; DDS_StdString barScopedName = NameToString(name(), "_"); localName = local_name()->get_string(); SetName(localName); enclosingScope = be_Type::EnclosingScopeString(this); m_tc_ctor_val = (DDS_StdString) barScopedName + "_ctor"; m_tc_dtor_val = (DDS_StdString) barScopedName + "_dtor"; m_tc_put_val = "(DDS::TypeCode::PutFunc) 0"; m_tc_get_val = "(DDS::TypeCode::GetFunc) 0"; m_tc_assign_val = (DDS_StdString) barScopedName + "_copy"; SetScopedClassName(ScopedName()); AddParent (new be_ClassParent (userException, userException, true, false)); m_typecode->kind = DDS::tk_except; m_typecode->id = get_decl_pragmas().get_repositoryID()->get_string(); m_typecode->name_of_type = localName; InitializeTypeMap(this); }
void be_attribute::GenerateVirtual ( be_Source& source, const DDS_StdString& className ) { ostream & os = source.Stream(); be_Tab tab(source); DDS_StdString responsibility = NameToString(name()); if (fieldType) { // PURE VIRTUAL GET ATTRIBUTE os << tab << "virtual " << GetSignature(AT_Declaration, className); os << " = 0;" << nl; // PURE VIRTUAL SET ATTRIBUTE if (!readonly()) { os << tab << "virtual " << SetSignature(AT_Declaration, className, pbtrue); os << " = 0;" << nl; } } }
void be_structure::InitializeTypeMap(be_Type* t) { idlType = t; if (t) { AST_Type * t_ast = (AST_Type*)t->narrow((long) & AST_Type::type_id); assert(t_ast); t->TypeName(NameToString(t_ast->name())); t->InTypeName("const " + t->TypeName() + "&"); t->InOutTypeName(t->TypeName() + "&"); t->VarSignature(VT_InParam, t->TypeName(), VT_Const, VT_Var, VT_Reference); t->VarSignature(VT_InOutParam, t->TypeName(), VT_NonConst, VT_Var, VT_Reference); if (t->IsFixedLength()) { t->OutTypeName(t->TypeName() + "&"); t->ReturnTypeName(t->TypeName()); t->VarSignature(VT_OutParam, t->TypeName(), VT_NonConst, VT_Var, VT_Reference); t->VarSignature(VT_Return, t->TypeName(), VT_NonConst, VT_Var, VT_NonReference); } else { t->OutTypeName(t->TypeName() + DDSOutExtension); t->ReturnTypeName(t->TypeName() + "*"); t->VarSignature(VT_OutParam, t->OutTypeName(), VT_NonConst, VT_Var, VT_NonReference); t->VarSignature(VT_Return, t->TypeName(), VT_NonConst, VT_Pointer, VT_NonReference); } t->DMFAdtMemberTypeName(t->TypeName() + "*"); t->StructMemberTypeName(t->TypeName()); t->UnionMemberTypeName(t->TypeName()); t->SequenceMemberTypeName(t->TypeName()); DDS_StdString basename = NameToString(t_ast->name(), "_"); t->TypeCodeTypeName(BE_Globals::TCPrefix + t->LocalName()); t->MetaTypeTypeName(BE_Globals::MTPrefix + basename); t->TypeCodeBaseName(BE_Globals::TCBasePrefix + basename); t->TypeCodeRepName(BE_Globals::TCRepPrefix + basename); } }
void be_enum::InitializeTypeMap(be_Type* t) { idlType = t; if (t) { AST_Type* t_ast = (AST_Type*)t->narrow((long) & AST_Type::type_id); assert(t_ast); t->TypeName(NameToString(t_ast->name())); t->InTypeName(t->TypeName()); t->InOutTypeName(t->TypeName() + "&"); t->OutTypeName(t->TypeName() + "&"); t->ReturnTypeName(t->TypeName()); t->DMFAdtMemberTypeName(t->TypeName()); t->StructMemberTypeName(t->TypeName()); t->UnionMemberTypeName(t->TypeName()); t->SequenceMemberTypeName(t->TypeName()); t->VarSignature(VT_InParam, t->TypeName(), VT_NonConst, VT_Var, VT_NonReference); t->VarSignature(VT_InOutParam, t->TypeName(), VT_NonConst, VT_Var, VT_Reference); t->VarSignature(VT_OutParam, t->TypeName(), VT_NonConst, VT_Var, VT_Reference); t->VarSignature(VT_Return, t->TypeName(), VT_NonConst, VT_Var, VT_NonReference); t->TypeCodeTypeName(BE_Globals::TCPrefix + t->LocalName()); DDS_StdString scopebar = NameToString(t_ast->name(), "_"); t->TypeCodeBaseName(BE_Globals::TCBasePrefix + scopebar); t->TypeCodeRepName(BE_Globals::TCRepPrefix + scopebar); t->MetaTypeTypeName(BE_Globals::MTPrefix + scopebar); } else { assert(0); } }
be_operation::be_operation ( AST_Type * rt, AST_Operation::Flags fl, UTL_ScopedName * n, const UTL_Pragmas & p ) : AST_Decl (AST_Decl::NT_op, n, p), UTL_Scope (AST_Decl::NT_op, n, p), AST_Operation (rt, fl, n, p), returnType (0), n_InArgs (0), n_OutArgs (0), n_InOutArgs (0), n_Args (0) { assert (return_type ()); isAtModuleScope (pbfalse); if (return_type ()) { returnType = (be_DispatchableType *) return_type ()-> narrow ((long) &be_DispatchableType::type_id); const char * typeName = returnType->TypeName (); if (typeName && strcmp (typeName, "DDS::Any") == 0) { BE_Globals::inc_any = pbtrue; } } else { DDSError ((DDS_StdString) "unknown return type for operation " + LocalName ()); } enclosingScope = be_Type::EnclosingScopeString (this); stubClassname = enclosingScope + DDSStubExtension; opKey = NameToString (name (), "_"); }
be_enum::be_enum (UTL_ScopedName *n, const UTL_Pragmas &p) : AST_Decl (AST_Decl::NT_enum, n, p), UTL_Scope (AST_Decl::NT_enum, n, p), AST_Enum (n, p) { isAtModuleScope(pbfalse); DDS_StdString barScopedName = NameToString(name(), "_"); m_swapCall = "SWAP32"; localName = local_name()->get_string(); enclosingScope = be_Type::EnclosingScopeString(this); m_typecode->kind = DDS::tk_enum; m_typecode->id = get_decl_pragmas().get_repositoryID()->get_string(); m_typecode->name_of_type = localName; m_tc_put_val = (DDS_StdString) "DDS_put_" + barScopedName + "_param"; m_tc_get_val = (DDS_StdString) "DDS_get_" + barScopedName + "_param"; m_any_op_id = barScopedName; InitializeTypeMap(this); be_root::AddTypeThatNeedsProtoTypeCodeFinished(*this); }
be_structure::be_structure(UTL_ScopedName *n, const UTL_Pragmas &p) : AST_Decl (AST_Decl::NT_struct, n, p), UTL_Scope (AST_Decl::NT_struct, n, p), m_isFixedLength (pbtrue), m_elemAlignment (0), m_maxElemAlignment (1), m_elemSize (0), m_canOptimize (pbfalse), m_lastFieldSize (0), m_cppScope (g_feScopeStack.Top()), m_cppType (g_feScopeStack.Top(), *n), m_interface_dependant (pbfalse) { DDS_StdString barScopedName = NameToString(name(), "_"); isAtModuleScope(pbfalse); localName = local_name()->get_string(); enclosingScope = be_Type::EnclosingScopeString(this); m_tc_ctor_val = (DDS_StdString) barScopedName + "_ctor"; m_tc_dtor_val = (DDS_StdString) barScopedName + "_dtor"; m_tc_put_val = (DDS_StdString) barScopedName + "_put"; m_tc_get_val = (DDS_StdString) barScopedName + "_get"; m_tc_assign_val = (DDS_StdString) barScopedName + "_copy"; m_any_op_id = barScopedName; m_nullArg = (DDS_StdString)"*(new " + ScopedName() + ")"; m_typecode->kind = DDS::tk_struct; m_typecode->id = get_decl_pragmas().get_repositoryID()->get_string(); m_typecode->name_of_type = localName; m_marshalInCore = FALSE; InitializeTypeMap(this); be_CppFwdDecl::Add(be_CppFwdDecl::STRUCT, this, m_cppScope); }
void be_enum::Generate(be_ClientHeader& source) { if (!Generated()) { UTL_ScopeActiveIterator* i = new UTL_ScopeActiveIterator(this, IK_decls); ostream & os = source.Stream(); unsigned long expectedValue = 0; be_Tab tab(source); AST_Decl * d; Generated(pbtrue); os << tab << "enum " << *local_name() << nl; os << tab << "{" << nl; tab.indent(); while (!(i->is_done())) { d = i->item (); if (d) { be_enum_val * ev = (be_enum_val*) d->narrow ((long) & be_enum_val::type_id); if (ev) { os << tab << *ev->local_name(); if (ev->Value() != expectedValue) { expectedValue = ev->Value(); os << " = " << expectedValue; } expectedValue++; i->next(); if (!(i->is_done())) { os << ","; } os << nl; } else { DDSError(NameToString(name()) + " contains non-enum val"); assert(pbfalse); } } else { DDSError(NameToString(name()) + " declaration is corrupted"); assert(pbfalse); } } //os << tab << "DDS_DCPS_FORCE_ENUM32(__" << *local_name() << ")" << nl; tab.outdent(); os << tab << "};" << nl; delete i; // GENERATE STREAMING OPERATORS be_root::AddAnyOps(*this); be_root::AddPutGetOps(*this); be_root::AddStreamOps(*this); be_root::AddTypedef(*this); be_root::AddTypecode(*this); } }
void State::WriteLine(string message) { //static const string StatesStrings[] = { "Init", "GoForBall" }; string stateName = NameToString();//StatesStrings[m_StateName]; Logger->Info(message + "\r\n", stateName); }