diff options
Diffstat (limited to 'modules/CIAO/CCF/CCF/CIDL')
32 files changed, 2067 insertions, 0 deletions
diff --git a/modules/CIAO/CCF/CCF/CIDL/CIDL.mpc b/modules/CIAO/CCF/CCF/CIDL/CIDL.mpc new file mode 100644 index 00000000000..833f3979582 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/CIDL.mpc @@ -0,0 +1,15 @@ +//$Id$ + +project(CIDL): cidlc { + sharedname = + staticname = CIDL + libout = .. + + Source_Files { + . + ./SemanticGraph + ./Traversal + ./SemanticAction + ./SemanticAction/Impl + } +} diff --git a/modules/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.cpp b/modules/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.cpp new file mode 100644 index 00000000000..6bc50409d28 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.cpp @@ -0,0 +1,27 @@ +// file : CCF/CIDL/LexicalAnalyzer.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/CIDL/LexicalAnalyzer.hpp" + +namespace CCF +{ + namespace CIDL + { + LexicalAnalyzer:: + LexicalAnalyzer (CompilerElements::TokenStream<Char>& is) + : IDL2::LexicalAnalyzer (is), + IDL3::LexicalAnalyzer (is) + { + // Keywords (alphabetic order). + + keyword_table_.insert ("composition"); + keyword_table_.insert ("entity" ); + keyword_table_.insert ("executor" ); + keyword_table_.insert ("implements" ); + keyword_table_.insert ("process" ); + keyword_table_.insert ("service" ); + keyword_table_.insert ("session" ); + } + } +} diff --git a/modules/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.hpp b/modules/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.hpp new file mode 100644 index 00000000000..978c06b8bef --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.hpp @@ -0,0 +1,22 @@ +// file : CCF/CIDL/LexicalAnalyzer.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_LEXICAL_ANALYZER_HPP +#define CCF_CIDL_LEXICAL_ANALYZER_HPP + +#include "CCF/IDL3/LexicalAnalyzer.hpp" + +namespace CCF +{ + namespace CIDL + { + class LexicalAnalyzer : public virtual IDL3::LexicalAnalyzer + { + public: + LexicalAnalyzer (CompilerElements::TokenStream<Char>& is); + }; + } +} + +#endif // CCF_CIDL_LEXICAL_ANALYZER_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/Parser.cpp b/modules/CIAO/CCF/CCF/CIDL/Parser.cpp new file mode 100644 index 00000000000..790410f3921 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/Parser.cpp @@ -0,0 +1,242 @@ +// file : CCF/CIDL/Parser.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/CIDL/Parser.hpp" + +// +// Note: DO NOT run emacs indenter (or any other indentation tool) over +// this file because it will most likely break BNF indentation. +// + +namespace CCF +{ + namespace CIDL + { + using IDL2::Parsing::DiagnosticType; + using IDL2::Parsing::RecoveryMethod; + + Parser:: + Parser (CompilerElements::Context& context, + Diagnostic::Stream& dout, + LexicalAnalyzer const& l, + SemanticAction::Factory& f) + : IDL2::Parser (context, dout, l, f), + IDL3::Parser (context, dout, l, f), + lexer_ (l), + actions_ (f), + + COMPOSITION ("composition"), + ENTITY ("entity" ), + EXECUTOR ("executor" ), + IMPLEMENTS ("implements" ), + PROCESS ("process" ), + SERVICE ("service" ), + SESSION ("session" ), + + // Composition + // + act_composition_begin ( + this, &Parser::act_composition_begin_core), + + act_composition_open_scope ( + f.composition (), &SemanticAction::Scope::open_scope), + + act_composition_close_scope ( + f.composition (), &SemanticAction::Scope::close_scope), + + act_composition_end ( + f.composition (), &SemanticAction::Composition::end), + + + // Home Executor + // + act_home_executor_begin ( + f.home_executor (), &SemanticAction::HomeExecutor::begin), + + act_home_executor_implements ( + f.home_executor (), &SemanticAction::HomeExecutor::implements), + + act_home_executor_manages ( + f.home_executor (), &SemanticAction::HomeExecutor::manages), + + act_home_executor_end ( + f.home_executor (), &SemanticAction::HomeExecutor::end) + + { + IDL3::Parser::extension = + composition_decl + | extension + ; + + // + // Composition + // + composition_decl = + COMPOSITION + >> guard + ( + ( + assertion ("composition category expected", + DiagnosticType::BEFORE) + ( + composition_category + ) + >> assertion ("composition name expected", + DiagnosticType::BEFORE) + ( + simple_identifier + ) + )[act_composition_begin] + + >> assertion ("'{' expected", + f.composition (), + &SemanticAction::Composition::end) + ( + LCBRACE[act_composition_open_scope] + ) + + >> assertion ("home executor declaration expected", + f.composition (), + &SemanticAction::Composition::close_scope, + &SemanticAction::Composition::end, + DiagnosticType::BEFORE) + ( + hood (home_executor_decl) + [ + handler (f.composition (), + &SemanticAction::Composition::close_scope, + &SemanticAction::Composition::end) + ] + ) + + >> assertion ("'}' expected", + f.composition (), + &SemanticAction::Composition::close_scope, + &SemanticAction::Composition::end, + DiagnosticType::BEFORE) + ( + RCBRACE[act_composition_close_scope] + ) + + >> assertion ("';' expected", + f.composition (), + &SemanticAction::Composition::end, + RecoveryMethod::NONE) + ( + SEMI[act_composition_end] + ) + + )[error_handler] + ; + + composition_category = + ENTITY + | PROCESS + | SERVICE + | SESSION + ; + + + // + // Home executor + // + home_executor_decl = + HOME + >> EXECUTOR + >> guard + ( + assertion ("home executor name expected", + DiagnosticType::BEFORE) + ( + simple_identifier[act_home_executor_begin] + ) + + >> assertion ("'{' expected", + f.home_executor (), + &SemanticAction::HomeExecutor::end) + ( + LCBRACE + ) + + >> assertion ("implements declaration expected", + f.home_executor (), + &SemanticAction::HomeExecutor::end, + DiagnosticType::BEFORE) + ( + hood (home_executor_home_impl_decl) + [ + handler (f.home_executor (), + &SemanticAction::HomeExecutor::end) + ] + ) + + >> assertion ("manages declaration expected", + f.home_executor (), + &SemanticAction::HomeExecutor::end, + DiagnosticType::BEFORE) + ( + hood (home_executor_executor_decl) + [ + handler (f.home_executor (), + &SemanticAction::HomeExecutor::end) + ] + ) + + >> assertion ("'}' expected", + f.home_executor (), + &SemanticAction::HomeExecutor::end, + DiagnosticType::BEFORE) + ( + RCBRACE + ) + + >> assertion ("';' expected", + f.home_executor (), + &SemanticAction::HomeExecutor::end, + RecoveryMethod::NONE) + ( + SEMI[act_home_executor_end] + ) + + )[error_handler] + ; + + + home_executor_home_impl_decl = + IMPLEMENTS + >> guard + ( + assertion ("home name expected", + DiagnosticType::BEFORE) + ( + identifier[act_home_executor_implements] + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] + ; + + + home_executor_executor_decl = + MANAGES + >> guard + ( + assertion ("executor name expected", + DiagnosticType::BEFORE) + ( + simple_identifier[act_home_executor_manages] + ) + >> assertion ("';' expected", + RecoveryMethod::NONE) + ( + SEMI + ) + )[error_handler] + ; + } + } +} diff --git a/modules/CIAO/CCF/CCF/CIDL/Parser.hpp b/modules/CIAO/CCF/CCF/CIDL/Parser.hpp new file mode 100644 index 00000000000..719f97f184d --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/Parser.hpp @@ -0,0 +1,123 @@ +// file : CCF/CIDL/Parser.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_PARSER_HPP +#define CCF_CIDL_PARSER_HPP + +#include "CCF/CompilerElements/Context.hpp" + +#include "CCF/IDL3/Parser.hpp" + +#include "CCF/CIDL/LexicalAnalyzer.hpp" +#include "CCF/CIDL/SemanticAction.hpp" + +namespace CCF +{ + namespace CIDL + { + using IDL3::ActionExecutor; + using IDL3::NoArgAction; + using IDL3::OneArgAction; + using IDL3::TwoArgAction; + + class Parser : public virtual IDL3::Parser + { + protected: + LexicalAnalyzer const& lexer_; + SemanticAction::Factory& actions_; + + // + // Primitives (alphabetic order). + // + + KeywordParser COMPOSITION; + KeywordParser ENTITY; + KeywordParser EXECUTOR; + KeywordParser IMPLEMENTS; + KeywordParser PROCESS; + KeywordParser SERVICE; + KeywordParser SESSION; + + // + // Language + // + + Rule extension; + + // Composition + Rule composition_decl; + Rule composition_category; + + // Home executor + Rule home_executor_decl; + Rule home_executor_home_impl_decl; + Rule home_executor_executor_decl; + + public: + Parser (CompilerElements::Context& context, + Diagnostic::Stream& dout, + LexicalAnalyzer const& l, + SemanticAction::Factory& f); + + protected: + void + act_composition_begin_core (Iterator begin, Iterator) const + { + SemanticAction::Composition::Category::Value c; + + if((*begin)->lexeme () == "entity") + { + c = SemanticAction::Composition::Category::entity; + } + else if ((*begin)->lexeme () == "process") + { + c = SemanticAction::Composition::Category::process; + } + else if ((*begin)->lexeme () == "service") + { + c = SemanticAction::Composition::Category::service; + } + else + { + c = SemanticAction::Composition::Category::session; + } + + begin++; + + actions_.composition ().begin ( + ReferenceCounting::strict_cast<SimpleIdentifier> (*begin), c); + } + + // Composition + // + ActionExecutor<Parser> + act_composition_begin; + + ScopeAction + act_composition_open_scope; + + ScopeAction + act_composition_close_scope; + + NoArgAction<SemanticAction::Composition> + act_composition_end; + + // Home Executor + // + OneArgAction<SimpleIdentifierPtr, SemanticAction::HomeExecutor> + act_home_executor_begin; + + OneArgAction<IdentifierPtr, SemanticAction::HomeExecutor> + act_home_executor_implements; + + OneArgAction<SimpleIdentifierPtr, SemanticAction::HomeExecutor> + act_home_executor_manages; + + NoArgAction<SemanticAction::HomeExecutor> + act_home_executor_end; + }; + } +} + +#endif // CCF_CIDL_PARSER_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction.hpp new file mode 100644 index 00000000000..faf75dbc28a --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction.hpp @@ -0,0 +1,17 @@ +// file : CCF/CIDL/SemanticAction.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_SEMANTIC_ACTION_HPP +#define CCF_CIDL_SEMANTIC_ACTION_HPP + +#include "CCF/IDL3/SemanticAction.hpp" + +#include "CCF/CIDL/SemanticAction/Elements.hpp" + +#include "CCF/CIDL/SemanticAction/Composition.hpp" +#include "CCF/CIDL/SemanticAction/HomeExecutor.hpp" + +#include "CCF/CIDL/SemanticAction/Factory.hpp" + +#endif // CCF_CIDL_SEMANTIC_ACTION_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Composition.cpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Composition.cpp new file mode 100644 index 00000000000..e8eb6f99924 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Composition.cpp @@ -0,0 +1,29 @@ +// file : CCF/CIDL/SemanticAction/Composition.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/CIDL/SemanticAction/Composition.hpp" + +#include <ostream> + +namespace CCF +{ + namespace CIDL + { + namespace SemanticAction + { + } + } +} + +namespace +{ + char* labels[] = {"entity", "process", "service", "session" }; +} + +std::ostream& +operator<< (std::ostream& o, + CCF::CIDL::SemanticAction::Composition::Category::Value v) +{ + return o << labels[v]; +} diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Composition.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Composition.hpp new file mode 100644 index 00000000000..8c46b83326c --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Composition.hpp @@ -0,0 +1,48 @@ +// file : CCF/CIDL/SemanticAction/Composition.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_SEMANTIC_ACTION_COMPOSITION_HPP +#define CCF_CIDL_SEMANTIC_ACTION_COMPOSITION_HPP + +#include "CCF/CIDL/SemanticAction/Elements.hpp" + +#include <iosfwd> + +namespace CCF +{ + namespace CIDL + { + namespace SemanticAction + { + struct Composition : Scope + { + struct Category + { + enum Value + { + entity , process, service, session + }; + }; + + virtual void + begin (SimpleIdentifierPtr const& id, Category::Value category) = 0; + + virtual void + open_scope () = 0; + + virtual void + close_scope () = 0; + + virtual void + end () = 0; + }; + } + } +} + +std::ostream& +operator<< (std::ostream& o, + CCF::CIDL::SemanticAction::Composition::Category::Value v); + +#endif // CCF_CIDL_SEMANTIC_ACTION_COMPOSITION_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Elements.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Elements.hpp new file mode 100644 index 00000000000..83c80bdf56b --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Elements.hpp @@ -0,0 +1,23 @@ +// file : CCF/CIDL/SemanticAction/Elements.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_SEMANTIC_ACTION_ELEMENTS_HPP +#define CCF_CIDL_SEMANTIC_ACTION_ELEMENTS_HPP + +#include "CCF/IDL3/SemanticAction/Elements.hpp" + +#include "CCF/CIDL/Token.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticAction + { + using IDL3::SemanticAction::Scope; + } + } +} + +#endif // CCF_CIDL_SEMANTIC_ACTION_ELEMENTS_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Factory.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Factory.hpp new file mode 100644 index 00000000000..521602ac70f --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Factory.hpp @@ -0,0 +1,31 @@ +// file : CCF/CIDL/SemanticAction/Factory.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_SEMANTIC_ACTION_FACTORY_HPP +#define CCF_CIDL_SEMANTIC_ACTION_FACTORY_HPP + +#include "CCF/IDL3/SemanticAction/Factory.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticAction + { + struct Composition; + struct HomeExecutor; + + struct Factory : virtual IDL3::SemanticAction::Factory + { + virtual Composition& + composition () = 0; + + virtual HomeExecutor& + home_executor () = 0; + }; + } + } +} + +#endif // CCF_CIDL_SEMANTIC_ACTION_FACTORY_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/HomeExecutor.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/HomeExecutor.hpp new file mode 100644 index 00000000000..ea8397fcf03 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/HomeExecutor.hpp @@ -0,0 +1,34 @@ +// file : CCF/CIDL/SemanticAction/HomeExecutor.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_SEMANTIC_ACTION_HOME_EXECUTOR_HPP +#define CCF_CIDL_SEMANTIC_ACTION_HOME_EXECUTOR_HPP + +#include "CCF/CIDL/SemanticAction/Elements.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticAction + { + struct HomeExecutor + { + virtual void + begin (SimpleIdentifierPtr const& id) = 0; + + virtual void + implements (IdentifierPtr const& id) = 0; + + virtual void + manages (SimpleIdentifierPtr const& id) = 0; + + virtual void + end () = 0; + }; + } + } +} + +#endif // CCF_CIDL_SEMANTIC_ACTION_HOME_EXECUTOR_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.cpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.cpp new file mode 100644 index 00000000000..a39a801cd15 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.cpp @@ -0,0 +1,83 @@ +// file : CCF/CIDL/SemanticAction/Impl/Composition.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/CIDL/SemanticAction/Impl/Composition.hpp" + +#include <iostream> + +using std::cerr; +using std::endl; + +namespace CCF +{ + namespace CIDL + { + namespace SemanticAction + { + namespace Impl + { + using namespace SemanticGraph; + + Composition:: + Composition (Context& c) + : ScopeBase<SemanticGraph::Composition> (c) + { + } + + void Composition:: + begin (SimpleIdentifierPtr const& id, Category::Value c) + { + if (ctx.trace ()) cerr << "composition " << id << endl; + + if(c == Category::entity) + { + now (ctx.tu ().new_node<EntityComposition> ( + ctx.file (), id->line ())); + } + else if (c == Category::process) + { + now (ctx.tu ().new_node<ProcessComposition> ( + ctx.file (), id->line ())); + } + else if (c == Category::service) + { + now (ctx.tu ().new_node<ServiceComposition> ( + ctx.file (), id->line ())); + } + else + { + now (ctx.tu ().new_node<SessionComposition> ( + ctx.file (), id->line ())); + } + + ctx.tu ().new_edge<Defines> (ctx.scope (), now (), id->lexeme ()); + } + + void Composition:: + open_scope () + { + if (ctx.trace ()) cerr << "scope open" << endl; + + push (ctx.scope ()); + ctx.scope (now ()); + } + + void Composition:: + close_scope () + { + ctx.scope (top ()); + pop (); + + if (ctx.trace ()) cerr << "scope close" << endl; + } + + void Composition:: + end () + { + if (ctx.trace ()) cerr << "end" << endl; + } + } + } + } +} diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.hpp new file mode 100644 index 00000000000..9bfce6dc78c --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.hpp @@ -0,0 +1,42 @@ +// file : CCF/CIDL/SemanticAction/Impl/Composition.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_SEMANTIC_ACTION_IMPL_COMPOSITION_HPP +#define CCF_CIDL_SEMANTIC_ACTION_IMPL_COMPOSITION_HPP + +#include "CCF/CIDL/SemanticGraph/Composition.hpp" +#include "CCF/CIDL/SemanticAction/Composition.hpp" +#include "CCF/CIDL/SemanticAction/Impl/Elements.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticAction + { + namespace Impl + { + struct Composition : SemanticAction::Composition, + ScopeBase<SemanticGraph::Composition> + { + Composition (Context& c); + + virtual void + begin (SimpleIdentifierPtr const& id, Category::Value c); + + virtual void + open_scope (); + + virtual void + close_scope (); + + virtual void + end (); + }; + } + } + } +} + +#endif // CCF_CIDL_SEMANTIC_ACTION_IMPL_COMPOSITION_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Elements.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Elements.hpp new file mode 100644 index 00000000000..5e4a0e2525e --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Elements.hpp @@ -0,0 +1,27 @@ +// file : CCF/CIDL/SemanticAction/Impl/Elements.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_SEMANTIC_ACTION_IMPL_ELEMENTS_HPP +#define CCF_CIDL_SEMANTIC_ACTION_IMPL_ELEMENTS_HPP + +#include "CCF/CIDL/SemanticAction/Elements.hpp" +#include "CCF/IDL3/SemanticAction/Impl/Elements.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticAction + { + namespace Impl + { + using IDL3::SemanticAction::Impl::Context; + using IDL3::SemanticAction::Impl::Base; + using IDL3::SemanticAction::Impl::ScopeBase; + } + } + } +} + +#endif // CCF_CIDL_SEMANTIC_ACTION_IMPL_ELEMENTS_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.cpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.cpp new file mode 100644 index 00000000000..37a6e589ca5 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.cpp @@ -0,0 +1,35 @@ +// file : CCF/CIDL/SemanticAction/Impl/Factory.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/Module.hpp" +#include "CCF/IDL2/SemanticGraph/Interface.hpp" + +#include "CCF/CIDL/SemanticAction/Impl/Factory.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticAction + { + namespace Impl + { + using namespace SemanticGraph; + + Factory:: + Factory (CompilerElements::Context& context, + Diagnostic::Stream& dout, + SemanticGraph::TranslationUnit& tu) + : IDL2::SemanticAction::Impl::Factory (context, dout, tu), + IDL3::SemanticAction::Impl::Factory (context, dout, tu), + + composition_ (ctx_), + home_executor_ (ctx_) + { + } + } + } + } +} diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.hpp new file mode 100644 index 00000000000..4cea4e35b82 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.hpp @@ -0,0 +1,53 @@ +// file : CCF/CIDL/SemanticAction/Impl/Factory.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_SEMANTIC_ACTION_IMPL_FACTORY_HPP +#define CCF_CIDL_SEMANTIC_ACTION_IMPL_FACTORY_HPP + +#include "CCF/CIDL/SemanticAction/Factory.hpp" +#include "CCF/IDL3/SemanticAction/Impl/Factory.hpp" + +#include "CCF/CIDL/SemanticAction/Impl/Composition.hpp" +#include "CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticAction + { + namespace Impl + { + // + // + // + struct Factory : virtual CIDL::SemanticAction::Factory, + virtual IDL3::SemanticAction::Impl::Factory + { + Factory (CompilerElements::Context& context, + Diagnostic::Stream& dout, + SemanticGraph::TranslationUnit& tu); + + virtual SemanticAction::Composition& + composition () + { + return composition_; + } + + virtual SemanticAction::HomeExecutor& + home_executor () + { + return home_executor_; + } + + private: + Composition composition_; + HomeExecutor home_executor_; + }; + } + } + } +} + +#endif // CCF_CIDL_SEMANTIC_ACTION_IMPL_FACTORY_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.cpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.cpp new file mode 100644 index 00000000000..acbb6e9f5e0 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.cpp @@ -0,0 +1,119 @@ +// file : CCF/CIDL/SemanticAction/Impl/HomeExecutor.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp" + +#include <iostream> + +using std::cerr; +using std::endl; + +namespace CCF +{ + namespace CIDL + { + namespace SemanticAction + { + namespace Impl + { + using namespace SemanticGraph; + + HomeExecutor:: + HomeExecutor (Context& c) + : Base (c) + { + } + + void HomeExecutor:: + begin (SimpleIdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "home executor " << id << endl; + + id_ = id; + he_ = &ctx.tu ().new_node<SemanticGraph::HomeExecutor> ( + ctx.file (), id->line ()); + } + + void HomeExecutor:: + implements (IdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "implements " << id << endl; + + Name name (id->lexeme ()); + ScopedName from (ctx.scope ().scoped_name ()); + + c_ = 0; + + try + { + try + { + SemanticGraph::Home& h ( + resolve<SemanticGraph::Home> (from, name, Flags::defined)); + + c_ = &dynamic_cast<SemanticGraph::Component&> ( + h.manages ().managee ()); + + ctx.tu ().new_edge<Implements> (*he_, h); + } + catch (Resolve const&) + { + cerr << ctx.file () << ":" << id->line () << ": error: " + << "invalid implements specification" << endl; + throw; + } + } + catch (NotFound const&) + { + cerr << ctx.file () << ":" << id->line () << ": error: " + << "no home with name \'" << name + << "\' visible from scope \'" << from << "\'" << endl; + } + catch (WrongType const&) + { + cerr << ctx.file () << ":" << id->line () << ": error: " + << "incompatible type in implements specification" << endl; + } + catch (NotDefined const& e) + { + cerr << ctx.file () << ":" << id->line () << ": error: " + << "attempt to implement forward-declared home " + << e.name () << endl; + + cerr << ctx.file () << ":" << id->line () << ": error: " + << "implementation of forward-declared home is illegal" + << endl; + } + } + + void HomeExecutor:: + manages (SimpleIdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "manages " << id << endl; + + if (c_ != 0) + { + SemanticGraph::ComponentExecutor& ce ( + ctx.tu ().new_node<SemanticGraph::ComponentExecutor> ( + ctx.file (), id->line ())); + + ctx.tu ().new_edge<Implements> (ce, *c_); + + ctx.tu ().new_edge<Defines> (ctx.scope (), ce, id->lexeme ()); + ctx.tu ().new_edge<Defines> (ctx.scope (), *he_, id_->lexeme ()); + + ctx.tu ().new_edge<Manages> (*he_, ce); + } + } + + void HomeExecutor:: + end () + { + id_ = 0; + if (ctx.trace ()) cerr << "end" << endl; + } + } + } + } +} diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp new file mode 100644 index 00000000000..23d3a3e7cca --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp @@ -0,0 +1,46 @@ +// file : CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_SEMANTIC_ACTION_IMPL_HOME_EXECUTOR_HPP +#define CCF_CIDL_SEMANTIC_ACTION_IMPL_HOME_EXECUTOR_HPP + +#include "CCF/CIDL/SemanticGraph/Executor.hpp" +#include "CCF/CIDL/SemanticAction/HomeExecutor.hpp" +#include "CCF/CIDL/SemanticAction/Impl/Elements.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticAction + { + namespace Impl + { + struct HomeExecutor : SemanticAction::HomeExecutor, Base + { + HomeExecutor (Context& c); + + virtual void + begin (SimpleIdentifierPtr const& id); + + virtual void + implements (IdentifierPtr const& id); + + virtual void + manages (SimpleIdentifierPtr const& id); + + virtual void + end (); + + private: + SimpleIdentifierPtr id_; + SemanticGraph::HomeExecutor* he_; + SemanticGraph::Component* c_; + }; + } + } + } +} + +#endif // CCF_CIDL_SEMANTIC_ACTION_IMPL_HOME_EXECUTOR_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticGraph.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph.hpp new file mode 100644 index 00000000000..9e4d2006029 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph.hpp @@ -0,0 +1,15 @@ +// file : CCF/CIDL/SemanticGraph.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_SEMANTIC_GRAPH_HPP +#define CCF_CIDL_SEMANTIC_GRAPH_HPP + +#include "CCF/IDL3/SemanticGraph.hpp" + +#include "CCF/CIDL/SemanticGraph/Elements.hpp" + +#include "CCF/CIDL/SemanticGraph/Composition.hpp" +#include "CCF/CIDL/SemanticGraph/Executor.hpp" + +#endif // CCF_CIDL_SEMANTIC_GRAPH_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.cpp b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.cpp new file mode 100644 index 00000000000..429699d1b5d --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.cpp @@ -0,0 +1,126 @@ +// file : CCF/CIDL/SemanticGraph/Composition.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/CIDL/SemanticGraph/Composition.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + + // Composition + // + // + namespace + { + TypeInfo + composition_init_ () + { + TypeInfo ti (typeid (Composition)); + ti.add_base (Access::PUBLIC, true, Scope::static_type_info ()); + return ti; + } + + TypeInfo composition_ (composition_init_ ()); + } + + TypeInfo const& Composition:: + static_type_info () { return composition_; } + + Composition:: + ~Composition () + { + } + + + // EntityComposition + // + // + namespace + { + TypeInfo + entity_composition_init_ () + { + TypeInfo ti (typeid (EntityComposition)); + ti.add_base ( + Access::PUBLIC, true, Composition::static_type_info ()); + return ti; + } + + TypeInfo entity_composition_ (entity_composition_init_ ()); + } + + TypeInfo const& EntityComposition:: + static_type_info () { return entity_composition_; } + + + // ProcessComposition + // + // + namespace + { + TypeInfo + process_composition_init_ () + { + TypeInfo ti (typeid (ProcessComposition)); + ti.add_base ( + Access::PUBLIC, true, Composition::static_type_info ()); + return ti; + } + + TypeInfo process_composition_ (process_composition_init_ ()); + } + + TypeInfo const& ProcessComposition:: + static_type_info () { return process_composition_; } + + + // ServiceComposition + // + // + namespace + { + TypeInfo + service_composition_init_ () + { + TypeInfo ti (typeid (ServiceComposition)); + ti.add_base ( + Access::PUBLIC, true, Composition::static_type_info ()); + return ti; + } + + TypeInfo service_composition_ (service_composition_init_ ()); + } + + TypeInfo const& ServiceComposition:: + static_type_info () { return service_composition_; } + + + // SessionComposition + // + // + namespace + { + TypeInfo + session_composition_init_ () + { + TypeInfo ti (typeid (SessionComposition)); + ti.add_base ( + Access::PUBLIC, true, Composition::static_type_info ()); + return ti; + } + + TypeInfo session_composition_ (session_composition_init_ ()); + } + + TypeInfo const& SessionComposition:: + static_type_info () { return session_composition_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.hpp new file mode 100644 index 00000000000..663029580da --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.hpp @@ -0,0 +1,103 @@ +// file : CCF/CIDL/SemanticGraph/Composition.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_SEMANTIC_GRAPH_COMPOSITION_HPP +#define CCF_CIDL_SEMANTIC_GRAPH_COMPOSITION_HPP + +#include "CCF/CIDL/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticGraph + { + class Composition : public virtual Scope + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Composition () // Only for virtual inheritance. + { + type_info (static_type_info ()); + } + + virtual + ~Composition () = 0; + }; + + class EntityComposition : public virtual Composition + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + EntityComposition (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + class ProcessComposition : public virtual Composition + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ProcessComposition (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + class ServiceComposition : public virtual Composition + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ServiceComposition (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + class SessionComposition : public virtual Composition + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + SessionComposition (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_CIDL_SEMANTIC_GRAPH_COMPOSITION_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Elements.cpp b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Elements.cpp new file mode 100644 index 00000000000..349f1854786 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Elements.cpp @@ -0,0 +1,33 @@ +// file : CCF/CIDL/SemanticGraph/Elements.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/CIDL/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + namespace + { + TypeInfo + implements_init_ () + { + TypeInfo ti (typeid (Implements)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo implements_ (implements_init_ ()); + } + + TypeInfo const& Implements:: + static_type_info () { return implements_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Elements.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Elements.hpp new file mode 100644 index 00000000000..625221116e7 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Elements.hpp @@ -0,0 +1,65 @@ +// file : CCF/CIDL/SemanticGraph/Elements.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_SEMANTIC_GRAPH_ELEMENTS_HPP +#define CCF_CIDL_SEMANTIC_GRAPH_ELEMENTS_HPP + +#include "CCF/IDL3/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticGraph + { + using namespace IDL3::SemanticGraph; + + + class Implements : public virtual Edge + { + public: + Type& + implementer () const + { + return *implementer_; + } + + Type& + implementee () const + { + return *implementee_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Implements () + { + type_info (static_type_info ()); + } + + void + set_left_node (Type& n) + { + implementer_ = &n; + } + + void + set_right_node (Type& n) + { + implementee_ = &n; + } + + private: + Type* implementer_; + Type* implementee_; + }; + } + } +} + +#endif // CCF_CIDL_SEMANTIC_GRAPH_ELEMENTS_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Executor.cpp b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Executor.cpp new file mode 100644 index 00000000000..9a4214bcd0e --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Executor.cpp @@ -0,0 +1,81 @@ +// file : CCF/CIDL/SemanticGraph/Executor.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/CIDL/SemanticGraph/Executor.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // Executor + // + // + namespace + { + TypeInfo + executor_init_ () + { + TypeInfo ti (typeid (Executor)); + ti.add_base (Access::PUBLIC, true, Type::static_type_info ()); + return ti; + } + + TypeInfo executor_ (executor_init_ ()); + } + + TypeInfo const& Executor:: + static_type_info () { return executor_; } + + Executor:: + ~Executor () + { + } + + + // ComponentExecutor + // + // + namespace + { + TypeInfo + component_executorinit_ () + { + TypeInfo ti (typeid (ComponentExecutor)); + ti.add_base (Access::PUBLIC, true, Type::static_type_info ()); + return ti; + } + + TypeInfo component_executor (component_executorinit_ ()); + } + + TypeInfo const& ComponentExecutor:: + static_type_info () { return component_executor; } + + + // HomeExecutor + // + // + namespace + { + TypeInfo + home_executorinit_ () + { + TypeInfo ti (typeid (HomeExecutor)); + ti.add_base (Access::PUBLIC, true, Type::static_type_info ()); + return ti; + } + + TypeInfo home_executor (home_executorinit_ ()); + } + + TypeInfo const& HomeExecutor:: + static_type_info () { return home_executor; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Executor.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Executor.hpp new file mode 100644 index 00000000000..378638b2187 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/SemanticGraph/Executor.hpp @@ -0,0 +1,122 @@ +// file : CCF/CIDL/SemanticGraph/Executor.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_SEMANTIC_GRAPH_EXECUTOR_HPP +#define CCF_CIDL_SEMANTIC_GRAPH_EXECUTOR_HPP + +#include "CCF/IDL3/SemanticGraph/Component.hpp" +#include "CCF/IDL3/SemanticGraph/Home.hpp" +#include "CCF/CIDL/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace SemanticGraph + { + // + // + // + class Executor : public virtual Type + { + public: + Implements& + implements () const + { + return *implements_; + } + + virtual bool + complete () const + { + return true; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Executor () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Executor () = 0; + + void + add_edge_left (Implements& e) + { + implements_ = &e; + } + + private: + Implements* implements_; + }; + + + // + // + // + class ComponentExecutor : public virtual Executor + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ComponentExecutor (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class HomeExecutor : public virtual Executor + { + public: + Manages& + manages () const + { + return *manages_; + } + + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + HomeExecutor (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + + using Executor::add_edge_left; + + void + add_edge_left (Manages& e) + { + manages_ = &e; + } + + private: + Manages* manages_; + }; + + } + } +} + +#endif // CCF_CIDL_SEMANTIC_GRAPH_EXECUTOR_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/Token.hpp b/modules/CIAO/CCF/CCF/CIDL/Token.hpp new file mode 100644 index 00000000000..40bd13b252c --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/Token.hpp @@ -0,0 +1,34 @@ +// file : CCF/CIDL/Token.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_TOKEN_HPP +#define CCF_CIDL_TOKEN_HPP + +#include "CCF/IDL3/Token.hpp" + +namespace CCF +{ + namespace CIDL + { + using IDL3::Token; + using IDL3::TokenPtr; + using IDL3::TokenList; + using IDL3::EndOfStream; + using IDL3::EndOfStreamPtr; + using IDL3::Keyword; + using IDL3::KeywordPtr; + using IDL3::Punctuation; + using IDL3::PunctuationPtr; + using IDL3::Identifier; + using IDL3::IdentifierPtr; + using IDL3::SimpleIdentifier; + using IDL3::SimpleIdentifierPtr; + using IDL3::ScopedIdentifier; + using IDL3::ScopedIdentifierPtr; + using IDL3::StringLiteral; + using IDL3::StringLiteralPtr; + } +} + +#endif // CCF_CIDL_TOKEN_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/Traversal.hpp b/modules/CIAO/CCF/CCF/CIDL/Traversal.hpp new file mode 100644 index 00000000000..119c813f554 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/Traversal.hpp @@ -0,0 +1,15 @@ +// file : CCF/CIDL/Traversal.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_TRAVERSAL_HPP +#define CCF_CIDL_TRAVERSAL_HPP + +#include "CCF/IDL3/Traversal.hpp" + +#include "CCF/CIDL/Traversal/Elements.hpp" + +#include "CCF/CIDL/Traversal/Composition.hpp" +#include "CCF/CIDL/Traversal/Executor.hpp" + +#endif // CCF_CIDL_TRAVERSAL_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/Traversal/Composition.hpp b/modules/CIAO/CCF/CCF/CIDL/Traversal/Composition.hpp new file mode 100644 index 00000000000..e93fa976e7e --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/Traversal/Composition.hpp @@ -0,0 +1,60 @@ +// file : CCF/CIDL/Traversal/Composition.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_TRAVERSAL_COMPOSITION_HPP +#define CCF_CIDL_TRAVERSAL_COMPOSITION_HPP + +#include "CCF/CIDL/SemanticGraph/Composition.hpp" +#include "CCF/CIDL/Traversal/Elements.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace Traversal + { + template <typename T> + struct CompositionTemplate : ScopeTemplate<T> + { + virtual void + traverse (T&); + + virtual void + pre (T&); + + virtual void + name (T&); + + virtual void + post (T&); + }; + + + typedef + CompositionTemplate <SemanticGraph::Composition> + Composition; + + typedef + CompositionTemplate <SemanticGraph::EntityComposition> + EntityComposition; + + typedef + CompositionTemplate <SemanticGraph::ProcessComposition> + ProcessComposition; + + typedef + CompositionTemplate <SemanticGraph::ServiceComposition> + ServiceComposition; + + + typedef + CompositionTemplate <SemanticGraph::SessionComposition> + SessionComposition; + } + } +} + +#include "CCF/CIDL/Traversal/Composition.tpp" + +#endif // CCF_CIDL_TRAVERSAL_COMPOSITION_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/Traversal/Composition.tpp b/modules/CIAO/CCF/CCF/CIDL/Traversal/Composition.tpp new file mode 100644 index 00000000000..8a6ff03e496 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/Traversal/Composition.tpp @@ -0,0 +1,41 @@ +// file : CCF/CIDL/Traversal/Composition.tpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +namespace CCF +{ + namespace CIDL + { + namespace Traversal + { + + template <typename T> + void CompositionTemplate<T>:: + traverse (T& c) + { + pre (c); + name (c); + names (c); + post (c); + } + + template <typename T> + void CompositionTemplate<T>:: + pre (T&) + { + } + + template <typename T> + void CompositionTemplate<T>:: + name (T&) + { + } + + template <typename T> + void CompositionTemplate<T>:: + post (T&) + { + } + } + } +} diff --git a/modules/CIAO/CCF/CCF/CIDL/Traversal/Elements.hpp b/modules/CIAO/CCF/CCF/CIDL/Traversal/Elements.hpp new file mode 100644 index 00000000000..72ffd2613db --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/Traversal/Elements.hpp @@ -0,0 +1,36 @@ +// file : CCF/CIDL/Traversal/Elements.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_TRAVERSAL_ELEMENTS_HPP +#define CCF_CIDL_TRAVERSAL_ELEMENTS_HPP + +#include "CCF/IDL3/Traversal/Elements.hpp" + +#include "CCF/CIDL/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace Traversal + { + using namespace IDL3::Traversal; + + // + // + // + struct Implements : Edge<SemanticGraph::Implements> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.implementee ()); + } + }; + + } + } +} + +#endif // CCF_CIDL_TRAVERSAL_ELEMENTS_HPP diff --git a/modules/CIAO/CCF/CCF/CIDL/Traversal/Executor.cpp b/modules/CIAO/CCF/CCF/CIDL/Traversal/Executor.cpp new file mode 100644 index 00000000000..efcb9681d66 --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/Traversal/Executor.cpp @@ -0,0 +1,195 @@ +// file : CCF/CIDL/Traversal/Executor.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/CIDL/Traversal/Executor.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace Traversal + { + // Executor + // + // + void Executor:: + traverse (Type& e) + { + pre (e); + name (e); + implements (e); + post (e); + } + + void Executor:: + pre (Type&) + { + } + + void Executor:: + name (Type&) + { + } + + void Executor:: + implements (Type& e, EdgeDispatcherBase& d) + { + d.traverse (e.implements ()); + } + + void Executor:: + implements (Type& e) + { + implements_pre (e); + implements (e, edge_traverser ()); + implements_post (e); + } + + void Executor:: + implements_pre (Type&) + { + } + + void Executor:: + implements_post (Type&) + { + } + + void Executor:: + post (Type&) + { + } + + + // ComponentExecutor + // + // + void ComponentExecutor:: + traverse (Type& e) + { + pre (e); + name (e); + implements (e); + post (e); + } + + void ComponentExecutor:: + pre (Type&) + { + } + + void ComponentExecutor:: + name (Type&) + { + } + + void ComponentExecutor:: + implements (Type& e, EdgeDispatcherBase& d) + { + d.traverse (e.implements ()); + } + + void ComponentExecutor:: + implements (Type& e) + { + implements_pre (e); + implements (e, edge_traverser ()); + implements_post (e); + } + + void ComponentExecutor:: + implements_pre (Type&) + { + } + + void ComponentExecutor:: + implements_post (Type&) + { + } + + void ComponentExecutor:: + post (Type&) + { + } + + + + // HomeExecutor + // + // + void HomeExecutor:: + traverse (Type& e) + { + pre (e); + name (e); + implements (e); + manages (e); + post (e); + } + + void HomeExecutor:: + pre (Type&) + { + } + + void HomeExecutor:: + name (Type&) + { + } + + void HomeExecutor:: + implements (Type& e, EdgeDispatcherBase& d) + { + d.traverse (e.implements ()); + } + + void HomeExecutor:: + implements (Type& e) + { + implements_pre (e); + implements (e, edge_traverser ()); + implements_post (e); + } + + void HomeExecutor:: + implements_pre (Type&) + { + } + + void HomeExecutor:: + implements_post (Type&) + { + } + + void HomeExecutor:: + manages (Type& e, EdgeDispatcherBase& d) + { + d.traverse (e.manages ()); + } + + void HomeExecutor:: + manages (Type& e) + { + manages_pre (e); + manages (e, edge_traverser ()); + manages_post (e); + } + + void HomeExecutor:: + manages_pre (Type&) + { + } + + void HomeExecutor:: + manages_post (Type&) + { + } + + void HomeExecutor:: + post (Type&) + { + } + } + } +} diff --git a/modules/CIAO/CCF/CCF/CIDL/Traversal/Executor.hpp b/modules/CIAO/CCF/CCF/CIDL/Traversal/Executor.hpp new file mode 100644 index 00000000000..6bb543aee9d --- /dev/null +++ b/modules/CIAO/CCF/CCF/CIDL/Traversal/Executor.hpp @@ -0,0 +1,125 @@ +// file : CCF/CIDL/Traversal/Executor.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_CIDL_TRAVERSAL_EXECUTOR_HPP +#define CCF_CIDL_TRAVERSAL_EXECUTOR_HPP + +#include "CCF/CIDL/SemanticGraph/Executor.hpp" + +#include "CCF/CIDL/Traversal/Elements.hpp" + +namespace CCF +{ + namespace CIDL + { + namespace Traversal + { + // + // + // + struct Executor : Node<SemanticGraph::Executor> + { + virtual void + traverse (Type& e); + + virtual void + pre (Type&); + + virtual void + name (Type&); + + virtual void + implements (Type&, EdgeDispatcherBase&); + + virtual void + implements (Type&); + + virtual void + implements_pre (Type&); + + virtual void + implements_post (Type&); + + virtual void + post (Type&); + }; + + + // + // + // + struct ComponentExecutor : Node<SemanticGraph::ComponentExecutor> + { + virtual void + traverse (Type& e); + + virtual void + pre (Type&); + + virtual void + name (Type&); + + virtual void + implements (Type&, EdgeDispatcherBase&); + + virtual void + implements (Type&); + + virtual void + implements_pre (Type&); + + virtual void + implements_post (Type&); + + virtual void + post (Type&); + }; + + + // + // + // + struct HomeExecutor : Node<SemanticGraph::HomeExecutor> + { + virtual void + traverse (Type& e); + + virtual void + pre (Type&); + + virtual void + name (Type&); + + virtual void + implements (Type&, EdgeDispatcherBase&); + + virtual void + implements (Type&); + + virtual void + implements_pre (Type&); + + virtual void + implements_post (Type&); + + virtual void + manages (Type&, EdgeDispatcherBase&); + + virtual void + manages (Type&); + + virtual void + manages_pre (Type&); + + virtual void + manages_post (Type&); + + virtual void + post (Type&); + }; + } + } +} + +#endif // CCF_CIDL_TRAVERSAL_EXECUTOR_HPP |