diff options
Diffstat (limited to 'modules/CIAO/CCF/CCF/IDL2/SemanticGraph')
51 files changed, 9020 insertions, 0 deletions
diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Array.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Array.cpp new file mode 100644 index 00000000000..3847a6b1ae3 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Array.cpp @@ -0,0 +1,37 @@ +// file : CCF/IDL2/SemanticGraph/Array.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Array.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // Array + // + // + namespace + { + TypeInfo + array_init_ () + { + TypeInfo ti (typeid (Array)); + ti.add_base ( + Access::PUBLIC, true, Specialization::static_type_info ()); + return ti; + } + + TypeInfo array_ (array_init_ ()); + } + + TypeInfo const& Array:: + static_type_info () { return array_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Array.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Array.hpp new file mode 100644 index 00000000000..baf2e5afe70 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Array.hpp @@ -0,0 +1,58 @@ +// file : CCF/IDL2/SemanticGraph/Array.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_ARRAY_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_ARRAY_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // + // + // + class Array : public virtual Specialization + { + public: + Type& + type () const + { + return + dynamic_cast<ArgumentsWithType&> (**arguments_begin ()).type (); + } + + // You will have to iterate through Arguments edges starting + // from begin + 1 to get to the list of bounds. I suggest that + // you use traversal instead. + // + + virtual bool + complete () const + { + // Is this the right semantic for arrays? + // + return type ().complete (); + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Array (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_ARRAY_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.cpp new file mode 100644 index 00000000000..2b2a99b09fb --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.cpp @@ -0,0 +1,145 @@ +// file : CCF/IDL2/SemanticGraph/Attribute.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Attribute.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // Attribute + // + // + namespace + { + TypeInfo + attribute_init_ () + { + TypeInfo ti (typeid (Attribute)); + ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ()); + ti.add_base (Access::PUBLIC, true, Instance::static_type_info ()); + return ti; + } + + TypeInfo attribute_ (attribute_init_ ()); + } + + TypeInfo const& Attribute:: + static_type_info () { return attribute_; } + + Attribute:: + ~Attribute () + { + } + + + // GetRaises + // + // + namespace + { + TypeInfo + get_raises_init_ () + { + TypeInfo ti (typeid (GetRaises)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo get_raises_ (get_raises_init_ ()); + } + + TypeInfo const& GetRaises:: + static_type_info () { return get_raises_; } + + + // ReadAttribute + // + // + namespace + { + TypeInfo + read_attribute_init_ () + { + TypeInfo ti (typeid (ReadAttribute)); + ti.add_base (Access::PUBLIC, true, Attribute::static_type_info ()); + return ti; + } + + TypeInfo read_attribute_ (read_attribute_init_ ()); + } + + TypeInfo const& ReadAttribute:: + static_type_info () { return read_attribute_; } + + + // SetRaises + // + // + namespace + { + TypeInfo + set_raises_init_ () + { + TypeInfo ti (typeid (SetRaises)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo set_raises_ (set_raises_init_ ()); + } + + TypeInfo const& SetRaises:: + static_type_info () { return set_raises_; } + + + // WriteAttribute + // + // + namespace + { + TypeInfo + write_attribute_init_ () + { + TypeInfo ti (typeid (WriteAttribute)); + ti.add_base (Access::PUBLIC, true, Attribute::static_type_info ()); + return ti; + } + + TypeInfo write_attribute_ (write_attribute_init_ ()); + } + + TypeInfo const& WriteAttribute:: + static_type_info () { return write_attribute_; } + + + // ReadWriteAttribute + // + // + namespace + { + TypeInfo + read_write_attribute_init_ () + { + TypeInfo ti (typeid (ReadWriteAttribute)); + ti.add_base ( + Access::PUBLIC, true, ReadAttribute::static_type_info ()); + ti.add_base ( + Access::PUBLIC, true, WriteAttribute::static_type_info ()); + return ti; + } + + TypeInfo read_write_attribute_ (read_write_attribute_init_ ()); + } + + TypeInfo const& ReadWriteAttribute:: + static_type_info () { return read_write_attribute_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.hpp new file mode 100644 index 00000000000..c5f041f5c3d --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.hpp @@ -0,0 +1,264 @@ +// file : CCF/IDL2/SemanticGraph/Attribute.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_ATTRIBUTE_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_ATTRIBUTE_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/Exception.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // + // + // + class Attribute : public virtual Nameable, public virtual Instance + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Attribute () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Attribute () = 0; + }; + + + // + // + // + class ReadAttribute; + + // + // + // + class GetRaises : public virtual Edge + { + public: + ReadAttribute& + attribute () const + { + return *attribute_; + } + + Exception& + exception () const + { + return *exception_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + GetRaises () + { + type_info (static_type_info ()); + } + + void + set_left_node (ReadAttribute& a) + { + attribute_ = &a; + } + + void + set_right_node (Exception& n) + { + exception_ = &n; + } + + private: + ReadAttribute* attribute_; + Exception* exception_; + }; + + + // + // + // + class ReadAttribute : public virtual Attribute + { + typedef + std::vector<GetRaises*> + GetRaises_; + + public: + typedef + GetRaises_::const_iterator + GetRaisesIterator; + + GetRaisesIterator + get_raises_begin () const + { + return get_raises_.begin (); + } + + GetRaisesIterator + get_raises_end () const + { + return get_raises_.end (); + } + + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ReadAttribute (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + + void + add_edge_left (GetRaises& e) + { + get_raises_.push_back (&e); + } + + private: + GetRaises_ get_raises_; + }; + + + // + // + // + class WriteAttribute; + + // + // + // + class SetRaises : public virtual Edge + { + public: + WriteAttribute& + attribute () const + { + return *attribute_; + } + + Exception& + exception () const + { + return *exception_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + SetRaises () + { + type_info (static_type_info ()); + } + + void + set_left_node (WriteAttribute& a) + { + attribute_ = &a; + } + + void + set_right_node (Exception& n) + { + exception_ = &n; + } + + private: + WriteAttribute* attribute_; + Exception* exception_; + }; + + + class WriteAttribute : public virtual Attribute + { + typedef + std::vector<SetRaises*> + SetRaises_; + + public: + typedef + SetRaises_::const_iterator + SetRaisesIterator; + + SetRaisesIterator + set_raises_begin () const + { + return set_raises_.begin (); + } + + SetRaisesIterator + set_raises_end () const + { + return set_raises_.end (); + } + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + WriteAttribute (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + + void + add_edge_left (SetRaises& e) + { + set_raises_.push_back (&e); + } + + private: + SetRaises_ set_raises_; + }; + + + // + // + // + class ReadWriteAttribute : public virtual ReadAttribute, + public virtual WriteAttribute + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ReadWriteAttribute (Path const& path, unsigned long line) + : Node (path, line), + ReadAttribute (path, line), + WriteAttribute (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_ATTRIBUTE_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.cpp new file mode 100644 index 00000000000..824c7634404 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.cpp @@ -0,0 +1,656 @@ +// file : CCF/IDL2/SemanticGraph/Elements.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +#include <ostream> + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // Edge + // + // + Edge:: + ~Edge () + { + } + + Edge:: + Edge () + { + type_info (static_type_info ()); + } + + namespace + { + TypeInfo + edge_init_ () + { + TypeInfo ti (typeid (Edge)); + // I don't really need this information + // ti.add_base (Access::PUBLIC, true, Object::static_type_info ()); + return ti; + } + + TypeInfo edge_ (edge_init_ ()); + } + + TypeInfo const& Edge:: + static_type_info () { return edge_; } + + + // Node + // + // + Node:: + ~Node () + { + } + + Node:: + Node (Path const& file, unsigned long line) + : file_ (file), line_ (line) + { + type_info (static_type_info ()); + } + + Node:: + Node () + { + abort (); // This ctor should never be called. + } + + namespace + { + TypeInfo + node_init_ () + { + TypeInfo ti (typeid (Node)); + // I don't really need this information + // ti.add_base (Access::PUBLIC, true, Object::static_type_info ()); + return ti; + } + + TypeInfo node_ (node_init_ ()); + } + + TypeInfo const& Node:: + static_type_info () { return node_; } + + + // Names + // + // + namespace + { + TypeInfo + names_init_ () + { + TypeInfo ti (typeid (Names)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo names_ (names_init_ ()); + } + + TypeInfo const& Names:: + static_type_info () { return names_; } + + + // Defines + // + // + namespace + { + TypeInfo + defines_init_ () + { + TypeInfo ti (typeid (Defines)); + ti.add_base ( + Access::PUBLIC, true, Names::static_type_info ()); + return ti; + } + + TypeInfo defines_ (defines_init_ ()); + } + + TypeInfo const& Defines:: + static_type_info () { return defines_; } + + + // Mentions + // + // + namespace + { + TypeInfo + mentions_init_ () + { + TypeInfo ti (typeid (Mentions)); + ti.add_base (Access::PUBLIC, true, Names::static_type_info ()); + return ti; + } + + TypeInfo mentions_ (mentions_init_ ()); + } + + TypeInfo const& Mentions:: + static_type_info () { return mentions_; } + + + // Aliases + // + // + namespace + { + TypeInfo + aliases_init_ () + { + TypeInfo ti (typeid (Aliases)); + ti.add_base ( + Access::PUBLIC, true, Names::static_type_info ()); + return ti; + } + + TypeInfo aliases_ (aliases_init_ ()); + } + + TypeInfo const& Aliases:: + static_type_info () { return aliases_; } + + + // Nameable + // + // + + Nameable:: + ~Nameable () + { + } + + SimpleName Nameable:: + name () const + { + // The first entry should either be Mentions or Defines + // and it is the 'primary' name of the nameable entity. + // + return named_[0]->name (); + } + + ScopedName Nameable:: + scoped_name () const + { + // In general, scope that named us is named, in turn, + // by somebody else. + // + return ScopedName (named_[0]->scope ().scoped_name (), name ()); + } + + namespace + { + TypeInfo + nameable_init_ () + { + TypeInfo ti (typeid (Nameable)); + ti.add_base (Access::PUBLIC, true, Node::static_type_info ()); + return ti; + } + + TypeInfo nameable_ (nameable_init_ ()); + } + + TypeInfo const& Nameable:: + static_type_info () { return nameable_; } + + + // Extends + // + // + namespace + { + TypeInfo + extends_init_ () + { + TypeInfo ti (typeid (Extends)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo extends_ (extends_init_ ()); + } + + TypeInfo const& Extends:: + static_type_info () { return extends_; } + + + // Scope + // + // + Scope:: + ~Scope () + { + } + + Nameables Scope:: + lookup (Name const& name) const + { + Nameables r; + lookup (name, r); + return r; + } + + void Scope:: + lookup (Name const& name, Nameables& result) const + { + SimpleName first (*name.begin ()); + + NamesIteratorPair pair (find (first)); + + if (pair.first != pair.second) // Found something. + { + if (name.simple ()) // last name + { + for (NamesIterator n (pair.first); n != pair.second; ++n) + { + result.insert (&((**n).named ())); + } + } + else + { + Name rest (name.begin () + 1, name.end ()); + + for (NamesIterator n (pair.first); n != pair.second; ++n) + { + Nameable& node ((**n).named ()); + if (Scope* s = dynamic_cast<Scope*> (&node)) + { + s->lookup (rest, result); + } + } + } + } + else // Try scopes that we are an extension of. + { + for (ExtendsIterator i (extends_begin ()), e (extends_end ()); + i != e; ++i) + { + (**i).extendee ().lookup (name, result); + } + } + } + + void Scope:: + add_edge_left (Names& e) + { + names_.push_back (&e); + names_map_[e.name ()].push_back (&e); + } + + namespace + { + TypeInfo + scope_init_ () + { + TypeInfo ti (typeid (Scope)); + ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ()); + return ti; + } + + TypeInfo scope_ (scope_init_ ()); + } + + TypeInfo const& Scope:: + static_type_info () { return scope_; } + + + // Type + // + // + namespace + { + TypeInfo + type_init_ () + { + TypeInfo ti (typeid (Type)); + ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ()); + return ti; + } + + TypeInfo type_ (type_init_ ()); + } + + TypeInfo const& Type:: + static_type_info () { return type_; } + + Type:: + ~Type () + { + } + + // Instance + // + // + namespace + { + TypeInfo + instance_init_ () + { + TypeInfo ti (typeid (Instance)); + ti.add_base (Access::PUBLIC, true, Node::static_type_info ()); + return ti; + } + + TypeInfo instance_ (instance_init_ ()); + } + + TypeInfo const& Instance:: + static_type_info () { return instance_; } + + Instance:: + ~Instance () + { + } + + // Belongs + // + // + namespace + { + TypeInfo + belongs_init_ () + { + TypeInfo ti (typeid (Belongs)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo belongs_ (belongs_init_ ()); + } + + TypeInfo const& Belongs:: + static_type_info () { return belongs_; } + + + // Specialization + // + // + namespace + { + TypeInfo + specialization_init_ () + { + TypeInfo ti (typeid (Specialization)); + ti.add_base (Access::PUBLIC, true, Type::static_type_info ()); + return ti; + } + + TypeInfo specialization_ ( + specialization_init_ ()); + } + + TypeInfo const& Specialization:: + static_type_info () { return specialization_; } + + void Specialization:: + add_edge_right (ArgumentsWithType& e) + { + arguments_.push_back (&e); + } + + void Specialization:: + add_edge_right (ArgumentsWithValue& e) + { + arguments_.push_back (&e); + } + + Specialization:: + ~Specialization () + { + } + + + // Arguments + // + // + namespace + { + TypeInfo + arguments_init_ () + { + TypeInfo ti (typeid (Arguments)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo arguments_ (arguments_init_ ()); + } + + TypeInfo const& Arguments:: + static_type_info () { return arguments_; } + + + // ArgumentsWithType + // + // + namespace + { + TypeInfo + arguments_with_type_init_ () + { + TypeInfo ti (typeid (ArgumentsWithType)); + ti.add_base (Access::PUBLIC, true, Arguments::static_type_info ()); + return ti; + } + + TypeInfo arguments_with_type_ (arguments_with_type_init_ ()); + } + + TypeInfo const& ArgumentsWithType:: + static_type_info () { return arguments_with_type_; } + + + // ArgumentsWithValue + // + // + namespace + { + TypeInfo + arguments_with_value_init_ () + { + TypeInfo ti (typeid (ArgumentsWithValue)); + ti.add_base (Access::PUBLIC, true, Arguments::static_type_info ()); + return ti; + } + + TypeInfo arguments_with_value_ (arguments_with_value_init_ ()); + } + + TypeInfo const& ArgumentsWithValue:: + static_type_info () { return arguments_with_value_; } + + Expression& ArgumentsWithValue:: + value () const + { + return dynamic_cast<Expression&> (argument ()); + } + + void ArgumentsWithValue:: + set_left_node (Expression& n) + { + Arguments::set_left_node (n); + } + + // IsA + // + // + namespace + { + TypeInfo + is_a_init_ () + { + TypeInfo ti (typeid (IsA)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo is_a_ (is_a_init_ ()); + } + + TypeInfo const& IsA:: + static_type_info () { return is_a_; } + + + // Inherits + // + // + namespace + { + TypeInfo + inherits_init_ () + { + TypeInfo ti (typeid (Inherits)); + ti.add_base (Access::PUBLIC, true, IsA::static_type_info ()); + return ti; + } + + TypeInfo inherits_ (inherits_init_ ()); + } + + TypeInfo const& Inherits:: + static_type_info () { return inherits_; } + + + // Initializes + // + // + namespace + { + TypeInfo + initializes_init_ () + { + TypeInfo ti (typeid (Initializes)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo initializes_ (initializes_init_ ()); + } + + TypeInfo const& Initializes:: + static_type_info () { return initializes_; } + + + // Expression + // + // + namespace + { + TypeInfo + expression_init_ () + { + TypeInfo ti (typeid (Expression)); + ti.add_base (Access::PUBLIC, true, Node::static_type_info ()); + return ti; + } + + TypeInfo expression_ (expression_init_ ()); + } + + TypeInfo const& Expression:: + static_type_info () { return expression_; } + + Expression:: + ~Expression () + { + } + + + // Const + // + // + namespace + { + TypeInfo + const_init_ () + { + TypeInfo ti (typeid (Const)); + ti.add_base (Access::PUBLIC, true, Instance::static_type_info ()); + ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ()); + ti.add_base (Access::PUBLIC, true, Expression::static_type_info ()); + return ti; + } + + TypeInfo const_ (const_init_ ()); + } + + TypeInfo const& Const:: + static_type_info () { return const_; } + + Const:: + ~Const () + { + } + + // Contains + // + // + namespace + { + TypeInfo + contains_init_ () + { + TypeInfo ti (typeid (Contains)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo contains_ (contains_init_ ()); + } + + TypeInfo const& Contains:: + static_type_info () { return contains_; } + + + // Container + // + // + namespace + { + TypeInfo + container_init_ () + { + TypeInfo ti (typeid (Container)); + ti.add_base (Access::PUBLIC, true, Node::static_type_info ()); + return ti; + } + + TypeInfo container_ (container_init_ ()); + } + + TypeInfo const& Container:: + static_type_info () { return container_; } + + Container:: + ~Container () + { + } + } + } +} + +// +// +std::ostream& +operator<< (std::ostream& os, CCF::IDL2::SemanticGraph::Path const& path) +{ + return os << path.native_file_string (); +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.hpp new file mode 100644 index 00000000000..1f0c850f25e --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.hpp @@ -0,0 +1,1078 @@ +// file : CCF/IDL2/SemanticGraph/Elements.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_ELEMENTS_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_ELEMENTS_HPP + +#include <set> +#include <vector> +#include <iosfwd> + +#include "Graph.hpp" + +#include "CCF/CompilerElements/FileSystem.hpp" +#include "CCF/CompilerElements/Introspection.hpp" +#include "CCF/CompilerElements/Context.hpp" + +#include "CCF/IDL2/SemanticGraph/Name.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // + // + typedef fs::path Path; + + // + // + // + + class Node; + class Edge; + + + // Node & Edge + // + // + class Edge : public virtual Introspection::Object + { + public: + CompilerElements::Context const& + context () const + { + return context_; + } + + CompilerElements::Context& + context () + { + return context_; + } + + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + virtual + ~Edge (); + + Edge (); + + private: + CompilerElements::Context context_; + }; + + inline bool + operator== (Edge const& x, Edge const& y) + { + return &x == &y; + } + + class Node : public virtual Introspection::Object + { + public: + CompilerElements::Context const& + context () const + { + return context_; + } + + CompilerElements::Context& + context () + { + return context_; + } + + public: + Path const& + file () const + { + return file_; + } + + unsigned long + line () const + { + return line_; + } + + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + virtual + ~Node () = 0; + + Node (Path const& path, unsigned long line); + + Node (); // For virtual inheritance only. + + // This is a bunch of experimantal sink functions that allow + // extensions in the form of one-way edges (see Executor stuff + // in CIDL for example). + // + void + add_edge_left (Edge&) + { + } + + void + add_edge_right (Edge&) + { + } + + private: + Path file_; + unsigned long line_; + CompilerElements::Context context_; + }; + + inline bool + operator== (Node const& x, Node const& y) + { + return &x == &y; + } + + + // + // + // + class Scope; + class Nameable; + + class Names : public virtual Edge + { + public: + SimpleName + name () const + { + return name_; + } + + Scope& + scope () const + { + return *scope_; + } + + Nameable& + named () const + { + return *named_; + } + + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Names (SimpleName const& name) + : name_ (name) + { + type_info (static_type_info ()); + } + + void + set_left_node (Scope& n) + { + scope_ = &n; + } + + void + set_right_node (Nameable& n) + { + named_ = &n; + } + + private: + Scope* scope_; + Nameable* named_; + SimpleName name_; + }; + + class Defines : public virtual Names + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Defines (SimpleName const& name) + : Names (name) + { + type_info (static_type_info ()); + } + }; + + + class Mentions : public virtual Names + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Mentions (SimpleName const& name) + : Names (name) + { + type_info (static_type_info ()); + } + }; + + + class Aliases : public virtual Names + { + public: + SimpleName + synonym () const + { + return name (); + } + + /* + + Let me know if you need this function. + + ScopedName + eponym () const + { + } + */ + + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Aliases (SimpleName const& synonym) + : Names (synonym) + + { + type_info (static_type_info ()); + } + }; + + + class Nameable : public virtual Node + { + typedef + std::vector<Names*> + Named_; + + public: + virtual SimpleName + name () const; + + virtual ScopedName + scoped_name () const; + + bool + defined () const + { + return defined_; + } + + typedef + Named_::const_iterator + NamedIterator; + + NamedIterator + named_begin () const + { + return named_.begin (); + } + + NamedIterator + named_end () const + { + return named_.end (); + } + + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Nameable () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Nameable () = 0; + + void + add_edge_right (Defines& e) + { + defined_ = true; + named_.push_back (&e); + } + + void + add_edge_right (Names& e) + { + named_.push_back (&e); + } + + private: + Named_ named_; + bool defined_; + }; + + typedef + std::set<Nameable*> + Nameables; + + class Scope; + + class Extends : public virtual Edge + { + public: + Scope& extender () const + { + return *extender_; + } + + Scope& extendee () const + { + return *extendee_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Extends () + { + type_info (static_type_info ()); + } + + void + set_left_node (Scope& s) + { + extender_ = &s; + } + + void + set_right_node (Scope& s) + { + extendee_ = &s; + } + + private: + Scope* extender_; + Scope* extendee_; + }; + + class Scope : public virtual Nameable + { + private: + typedef + std::vector<Extends*> + Extends_; + + typedef + std::vector<Names*> + Names_; + + typedef + std::map<SimpleName, Names_> + NamesMap_; + + public: + // + // + typedef + Extends_::const_iterator + ExtendsIterator; + + ExtendsIterator + extends_begin () const + { + return extends_.begin (); + } + + ExtendsIterator + extends_end () const + { + return extends_.end (); + } + + + // + // + typedef + Names_::const_iterator + NamesIterator; + + typedef + std::pair <NamesIterator, NamesIterator> + NamesIteratorPair; + + NamesIterator + names_begin () const + { + return names_.begin (); + } + + NamesIterator + names_end () const + { + return names_.end (); + } + + NamesIteratorPair + find (SimpleName const& name) const + { + NamesMap_::const_iterator i (names_map_.find (name)); + if (i == names_map_.end ()) + { + return NamesIteratorPair (names_.end (), names_.end ()); + } + else + { + return NamesIteratorPair (i->second.begin (), i->second.end ()); + } + } + + Nameables + lookup (Name const& name) const; + + void + lookup (Name const& name, Nameables& result) const; + + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Scope () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Scope () = 0; + + void + add_edge_left (Names& e); + + void + add_edge_left (Extends& e) + { + extends_.push_back (&e); + } + + void + add_edge_right (Extends&) + { + } + + using Nameable::add_edge_right; + + private: + Extends_ extends_; + + Names_ names_; + NamesMap_ names_map_; + }; + + + + // + // + // + class Belongs; + class ArgumentsWithType; + + //@@ I can make an alias Classifies for Belongs? + // + + class Type : public virtual Nameable + { + public: + virtual bool + complete () const = 0; + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Type () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Type () = 0; + + using Nameable::add_edge_right; + + void + add_edge_right (Belongs& e) + { + slassifies_.push_back (&e); + } + + void + add_edge_left (ArgumentsWithType&) + { + } + + using Node::add_edge_right; + using Node::add_edge_left; + + private: + typedef + std::vector<Belongs*> + Classifies_; + + Classifies_ slassifies_; + }; + + + class Instance : public virtual Node + { + public: + Belongs& + belongs () const + { + return *belongs_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Instance () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Instance () = 0; + + void + add_edge_left (Belongs& e) + { + belongs_ = &e; + } + + private: + Belongs* belongs_; + }; + + + class Belongs : public virtual Edge + { + public: + Instance& + instance () const + { + return *instance_; + } + + Type& + type () const + { + return *type_; + } + + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Belongs () + { + type_info (static_type_info ()); + } + + void + set_left_node (Instance& n) + { + instance_ = &n; + } + + void + set_right_node (Type& n) + { + type_ = &n; + } + + private: + Instance* instance_; + Type* type_; + }; + + + // + // + class Arguments; + class ArgumentsWithType; + class ArgumentsWithValue; + + class Specialization: public virtual Type + { + typedef + std::vector<Arguments*> + Arguments_; + + public: + typedef + Arguments_::const_iterator + ArgumentsIterator; + + ArgumentsIterator + arguments_begin () const + { + return arguments_.begin (); + } + + ArgumentsIterator + arguments_end () const + { + return arguments_.end (); + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Specialization () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Specialization () = 0; + + void + add_edge_right (ArgumentsWithType& e); + + void + add_edge_right (ArgumentsWithValue& e); + + private: + Arguments_ arguments_; + }; + + + class Arguments: public virtual Edge + { + public: + Specialization& + specialization () const + { + return *specialization_; + } + + Node& + argument () const + { + return *argument_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Arguments () + { + type_info (static_type_info ()); + } + + void + set_left_node (Node& n) + { + argument_ = &n; + } + + void + set_right_node (Specialization& n) + { + specialization_ = &n; + } + + private: + Specialization* specialization_; + Node* argument_; + }; + + class ArgumentsWithType: public virtual Arguments + { + public: + Type& + type () const + { + return dynamic_cast<Type&> (argument ()); + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ArgumentsWithType () + { + type_info (static_type_info ()); + } + + void + set_left_node (Type& n) + { + Arguments::set_left_node (n); + } + }; + + class Expression; + + class ArgumentsWithValue: public virtual Arguments + { + public: + Expression& + value () const; + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ArgumentsWithValue () + { + type_info (static_type_info ()); + } + + void + set_left_node (Expression& n); + }; + + // + // + // + class IsA : public virtual Edge + { + public: + virtual Type& + subject () const + { + return *subject_; + } + + virtual Type& + object () const + { + return *object_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IsA () + { + type_info (static_type_info ()); + } + + void + set_left_node (Type& n) + { + subject_ = &n; + } + + void + set_right_node (Type& n) + { + object_ = &n; + } + + private: + Type* subject_; + Type* object_; + }; + + + // + // + // + class Inherits : public virtual IsA + { + public: + virtual Type& + inheritor () const + { + return subject (); + } + + virtual Type& + inheritee () const + { + return object (); + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Inherits () + { + type_info (static_type_info ()); + } + }; + + + // + // + + class Expression; + class Const; + + class Initializes: public virtual Edge + { + public: + Expression& + expression () const + { + return *expression_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Initializes () + { + type_info (static_type_info ()); + } + + void + set_left_node (Expression& e) + { + expression_ = &e; + } + + void + set_right_node (Const&) + { + } + + private: + Expression* expression_; + }; + + + class Expression: public virtual Node + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Expression () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Expression () = 0; + + void + add_edge_left (Initializes&) + { + } + + void + add_edge_left (ArgumentsWithValue&) + { + } + }; + + + class Const: public virtual Instance, + public virtual Nameable, + public virtual Expression + { + public: + Initializes& + initialized () const + { + return *initialized_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Const () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Const () = 0; + + using Instance::add_edge_left; + using Expression::add_edge_left; + + void + add_edge_right (Initializes& i) + { + initialized_ = &i; + } + + using Nameable::add_edge_right; + + private: + Initializes* initialized_; + }; + + + // + // + // + + class Container; + + class Contains : public virtual Edge + { + public: + Node& + element () const + { + return *element_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Contains () + { + type_info (static_type_info ()); + } + + void + set_left_node (Container& n) + { + container_ = &n; + } + + void + set_right_node (Node& n) + { + element_ = &n; + } + + private: + Container* container_; + Node* element_; + }; + + + class Container : public virtual Node + { + typedef + std::vector<Contains*> + Contains_; + + public: + typedef + Contains_::const_iterator + ContainsIterator; + + ContainsIterator + contains_begin () const + { + return contains_.begin (); + } + + ContainsIterator + contains_end () const + { + return contains_.end (); + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Container () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Container () = 0; + + void + add_edge_left (Contains& e) + { + contains_.push_back (&e); + } + + private: + Contains_ contains_; + }; + } + } +} + +// ADL won't find it because Path is a typedef. Note that this +// function prints in native format. +// +std::ostream& +operator<< (std::ostream& os, CCF::IDL2::SemanticGraph::Path const& path); + +#include "CCF/IDL2/SemanticGraph/Elements.tpp" + +#endif // CCF_IDL2_SEMANTIC_GRAPH_ELEMENTS_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.tpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.tpp new file mode 100644 index 00000000000..a3a1615fe85 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.tpp @@ -0,0 +1,14 @@ +// file : CCF/IDL2/SemanticGraph/Elements.tpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + } + } +} + diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.cpp new file mode 100644 index 00000000000..e5de88c449e --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.cpp @@ -0,0 +1,58 @@ +// file : CCF/IDL2/SemanticGraph/Enum.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Enum.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // Enum + // + // + namespace + { + TypeInfo + enum_init_ () + { + TypeInfo ti (typeid (Enum)); + ti.add_base (Access::PUBLIC, true, Type::static_type_info ()); + ti.add_base (Access::PUBLIC, true, Scope::static_type_info ()); + return ti; + } + + TypeInfo enum_ (enum_init_ ()); + } + + TypeInfo const& Enum:: + static_type_info () { return enum_; } + + + // Enumerator + // + // + namespace + { + TypeInfo + enumerator_init_ () + { + TypeInfo ti (typeid (Enumerator)); + ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ()); + ti.add_base (Access::PUBLIC, true, Instance::static_type_info ()); + return ti; + } + + TypeInfo enumerator_ (enumerator_init_ ()); + } + + TypeInfo const& Enumerator:: + static_type_info () { return enumerator_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.hpp new file mode 100644 index 00000000000..9179b471791 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.hpp @@ -0,0 +1,58 @@ +// file : CCF/IDL2/SemanticGraph/Enum.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_ENUM_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_ENUM_HPP + +#include "CCF/IDL2/SemanticGraph/IntExpression.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + class Enum : public virtual Type + { + public: + virtual bool + complete () const + { + return true; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Enum (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + class Enumerator : public virtual Nameable, public virtual IntConst + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Enumerator (Path const& path, unsigned long line) + : Node (path, line), IntConst (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_ENUM_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.cpp new file mode 100644 index 00000000000..9ed3a7e494b --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.cpp @@ -0,0 +1,34 @@ +// file : CCF/IDL2/SemanticGraph/Exception.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Exception.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + namespace + { + TypeInfo + exception_init_ () + { + TypeInfo ti (typeid (Exception)); + ti.add_base (Access::PUBLIC, true, Type::static_type_info ()); + ti.add_base (Access::PUBLIC, true, Scope::static_type_info ()); + return ti; + } + + TypeInfo exception_ (exception_init_ ()); + } + + TypeInfo const& Exception:: + static_type_info () { return exception_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.hpp new file mode 100644 index 00000000000..712cdf1ca8a --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.hpp @@ -0,0 +1,51 @@ +// file : CCF/IDL2/SemanticGraph/Exception.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_EXCEPTION_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_EXCEPTION_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + class Raises; + + class Exception : public virtual Type, public virtual Scope + { + public: + virtual bool + complete () const + { + return defined (); + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Exception (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + + using Type::add_edge_right; + using Scope::add_edge_left; + + void + add_edge_right (Raises&) + { + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_EXCEPTION_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp new file mode 100644 index 00000000000..789accfe3b9 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp @@ -0,0 +1,443 @@ +// file : CCF/IDL2/SemanticGraph/Fundamental.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +// Note, that this file is automatically generated! +// + +#include "CCF/IDL2/SemanticGraph/Fundamental.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // FundamentalType + // + // + namespace + { + TypeInfo + fundamental_type_init_ () + { + TypeInfo ti (typeid (FundamentalType)); + ti.add_base (Access::PUBLIC, true, Type::static_type_info ()); + return ti; + } + + TypeInfo fundamental_type_ (fundamental_type_init_ ()); + } + + TypeInfo const& FundamentalType:: + static_type_info () { return fundamental_type_; } + + FundamentalType:: + ~FundamentalType () + { + } + + + // Object + // + // + namespace + { + TypeInfo + object_init_ () + { + TypeInfo ti (typeid (Object)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo object_ (object_init_ ()); + } + + TypeInfo const& Object:: + static_type_info () { return object_; } + + + // ValueBase + // + // + namespace + { + TypeInfo + value_base_init_ () + { + TypeInfo ti (typeid (ValueBase)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo value_base_ (value_base_init_ ()); + } + + TypeInfo const& ValueBase:: + static_type_info () { return value_base_; } + + + // Any + // + // + namespace + { + TypeInfo + any_init_ () + { + TypeInfo ti (typeid (Any)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo any_ (any_init_ ()); + } + + TypeInfo const& Any:: + static_type_info () { return any_; } + + + // Boolean + // + // + namespace + { + TypeInfo + boolean_init_ () + { + TypeInfo ti (typeid (Boolean)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo boolean_ (boolean_init_ ()); + } + + TypeInfo const& Boolean:: + static_type_info () { return boolean_; } + + + // Char + // + // + namespace + { + TypeInfo + char_init_ () + { + TypeInfo ti (typeid (Char)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo char_ (char_init_ ()); + } + + TypeInfo const& Char:: + static_type_info () { return char_; } + + + // Double + // + // + namespace + { + TypeInfo + double_init_ () + { + TypeInfo ti (typeid (Double)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo double_ (double_init_ ()); + } + + TypeInfo const& Double:: + static_type_info () { return double_; } + + + // Float + // + // + namespace + { + TypeInfo + float_init_ () + { + TypeInfo ti (typeid (Float)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo float_ (float_init_ ()); + } + + TypeInfo const& Float:: + static_type_info () { return float_; } + + + // Long + // + // + namespace + { + TypeInfo + long_init_ () + { + TypeInfo ti (typeid (Long)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo long_ (long_init_ ()); + } + + TypeInfo const& Long:: + static_type_info () { return long_; } + + + // LongDouble + // + // + namespace + { + TypeInfo + long_double_init_ () + { + TypeInfo ti (typeid (LongDouble)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo long_double_ (long_double_init_ ()); + } + + TypeInfo const& LongDouble:: + static_type_info () { return long_double_; } + + + // LongLong + // + // + namespace + { + TypeInfo + long_long_init_ () + { + TypeInfo ti (typeid (LongLong)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo long_long_ (long_long_init_ ()); + } + + TypeInfo const& LongLong:: + static_type_info () { return long_long_; } + + + // Octet + // + // + namespace + { + TypeInfo + octet_init_ () + { + TypeInfo ti (typeid (Octet)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo octet_ (octet_init_ ()); + } + + TypeInfo const& Octet:: + static_type_info () { return octet_; } + + + // Short + // + // + namespace + { + TypeInfo + short_init_ () + { + TypeInfo ti (typeid (Short)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo short_ (short_init_ ()); + } + + TypeInfo const& Short:: + static_type_info () { return short_; } + + + // String + // + // + namespace + { + TypeInfo + string_init_ () + { + TypeInfo ti (typeid (String)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo string_ (string_init_ ()); + } + + TypeInfo const& String:: + static_type_info () { return string_; } + + + // UnsignedLong + // + // + namespace + { + TypeInfo + unsigned_long_init_ () + { + TypeInfo ti (typeid (UnsignedLong)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo unsigned_long_ (unsigned_long_init_ ()); + } + + TypeInfo const& UnsignedLong:: + static_type_info () { return unsigned_long_; } + + + // UnsignedLongLong + // + // + namespace + { + TypeInfo + unsigned_long_long_init_ () + { + TypeInfo ti (typeid (UnsignedLongLong)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo unsigned_long_long_ (unsigned_long_long_init_ ()); + } + + TypeInfo const& UnsignedLongLong:: + static_type_info () { return unsigned_long_long_; } + + + // UnsignedShort + // + // + namespace + { + TypeInfo + unsigned_short_init_ () + { + TypeInfo ti (typeid (UnsignedShort)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo unsigned_short_ (unsigned_short_init_ ()); + } + + TypeInfo const& UnsignedShort:: + static_type_info () { return unsigned_short_; } + + + // Void + // + // + namespace + { + TypeInfo + void_init_ () + { + TypeInfo ti (typeid (Void)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo void_ (void_init_ ()); + } + + TypeInfo const& Void:: + static_type_info () { return void_; } + + + // Wchar + // + // + namespace + { + TypeInfo + wchar_init_ () + { + TypeInfo ti (typeid (Wchar)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo wchar_ (wchar_init_ ()); + } + + TypeInfo const& Wchar:: + static_type_info () { return wchar_; } + + + // Wstring + // + // + namespace + { + TypeInfo + wstring_init_ () + { + TypeInfo ti (typeid (Wstring)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo wstring_ (wstring_init_ ()); + } + + TypeInfo const& Wstring:: + static_type_info () { return wstring_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp.m4 b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp.m4 new file mode 100644 index 00000000000..da1d8eca574 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp.m4 @@ -0,0 +1,103 @@ +divert(-1) + +# file : CCF/IDL2/SemanticGraph/Fundamental.cpp.m4 +# author : Boris Kolpackov <boris@dre.vanderbilt.edu> +# cvs-id : $Id$ + +include(`Fundamental.m4') + +define(`fundamental_type', + `fundamental_type_impl(`make_class_name(`$1')', `make_var_name(`$1')')') + + +define(`fundamental_type_impl', ` + + // $1 + // + // + namespace + { + TypeInfo + $2_init_ () + { + TypeInfo ti (typeid ($1)); + ti.add_base ( + Access::PUBLIC, true, FundamentalType::static_type_info ()); + return ti; + } + + TypeInfo $2_ ($2_init_ ()); + } + + TypeInfo const& $1:: + static_type_info () { return $2_; }') + +divert(0)dnl +dnl +dnl +dnl +// file : CCF/IDL2/SemanticGraph/Fundamental.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +// Note, that this file is automatically generated! +// + +#include "CCF/IDL2/SemanticGraph/Fundamental.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // FundamentalType + // + // + namespace + { + TypeInfo + fundamental_type_init_ () + { + TypeInfo ti (typeid (FundamentalType)); + ti.add_base (Access::PUBLIC, true, Type::static_type_info ()); + return ti; + } + + TypeInfo fundamental_type_ (fundamental_type_init_ ()); + } + + TypeInfo const& FundamentalType:: + static_type_info () { return fundamental_type_; } + + FundamentalType:: + ~FundamentalType () + { + } +dnl +fundamental_type(`object') +fundamental_type(`value base') +fundamental_type(`any') +fundamental_type(`boolean') +fundamental_type(`char') +fundamental_type(`double') +fundamental_type(`float') +fundamental_type(`long') +fundamental_type(`long double') +fundamental_type(`long long') +fundamental_type(`octet') +fundamental_type(`short') +fundamental_type(`string') +fundamental_type(`unsigned long') +fundamental_type(`unsigned long long') +fundamental_type(`unsigned short') +fundamental_type(`void') +fundamental_type(`wchar') +fundamental_type(`wstring') +dnl + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp new file mode 100644 index 00000000000..a756acc352e --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp @@ -0,0 +1,427 @@ +// file : CCF/IDL2/SemanticGraph/Fundamental.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +// Note, that this file is automatically generated! +// + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_FUNDAMENTAL_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_FUNDAMENTAL_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // @@ Object & ValueBase should be of interface & valuetype types? + // + // + class FundamentalType : public virtual Type + { + public: + virtual bool + complete () const + { + return true; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + FundamentalType () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~FundamentalType () = 0; + }; + + + // + // + // + class Object : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Object (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class ValueBase : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ValueBase (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class Any : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Any (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class Boolean : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Boolean (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class Char : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Char (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class Double : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Double (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class Float : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Float (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class Long : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Long (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class LongDouble : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + LongDouble (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class LongLong : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + LongLong (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class Octet : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Octet (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class Short : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Short (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class String : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + String (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class UnsignedLong : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + UnsignedLong (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class UnsignedLongLong : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + UnsignedLongLong (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class UnsignedShort : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + UnsignedShort (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class Void : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Void (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class Wchar : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Wchar (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class Wstring : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Wstring (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_FUNDAMENTAL_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp.m4 b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp.m4 new file mode 100644 index 00000000000..864dcd76435 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp.m4 @@ -0,0 +1,102 @@ +divert(-1) + +# file : CCF/IDL2/SemanticGraph/Fundamental.hpp.m4 +# author : Boris Kolpackov <boris@dre.vanderbilt.edu> +# cvs-id : $Id$ + +include(`Fundamental.m4') + +define(`fundamental_type', `fundamental_type_impl(`make_class_name(`$1')', `$1')') + +define(`fundamental_type_impl', ` + + // + // + // + class $1 : public virtual FundamentalType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + $1 (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + };') +divert(0)dnl +dnl +dnl +dnl +// file : CCF/IDL2/SemanticGraph/Fundamental.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +// Note, that this file is automatically generated! +// + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_FUNDAMENTAL_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_FUNDAMENTAL_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // @@ Object & ValueBase should be of interface & valuetype types? + // + // + class FundamentalType : public virtual Type + { + public: + virtual bool + complete () const + { + return true; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + FundamentalType () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~FundamentalType () = 0; + }; +dnl +fundamental_type(`Object') +fundamental_type(`ValueBase') +fundamental_type(`any') +fundamental_type(`boolean') +fundamental_type(`char') +fundamental_type(`double') +fundamental_type(`float') +fundamental_type(`long') +fundamental_type(`long double') +fundamental_type(`long long') +fundamental_type(`octet') +fundamental_type(`short') +fundamental_type(`string') +fundamental_type(`unsigned long') +fundamental_type(`unsigned long long') +fundamental_type(`unsigned short') +fundamental_type(`void') +fundamental_type(`wchar') +fundamental_type(`wstring') +dnl + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_FUNDAMENTAL_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.m4 b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.m4 new file mode 100644 index 00000000000..5aaab71bd76 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.m4 @@ -0,0 +1,17 @@ +# file : CCF/IDL2/SemanticGraph/Fundamental.m4 +# author : Boris Kolpackov <boris@dre.vanderbilt.edu> +# cvs-id : $Id$ + +define(`upcase', `translit(`$*', `a-z', `A-Z')') + + +define(`capitalize_word', + `regexp(`$1', `^\(.\)\(.*\)', `upcase(`\1')`\2'')') + + +define(`capitalize', + `patsubst(`$1', `\w+', `capitalize_word(`\&')')') + +define(`make_class_name', `patsubst(capitalize(`$1'), ` ')') + +define(`make_var_name', `patsubst(`$1', ` ', `_')') diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.hpp new file mode 100644 index 00000000000..f71140569de --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.hpp @@ -0,0 +1,91 @@ +// file : CCF/IDL2/SemanticGraph/Graph.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef ELEMENT_GRAPH_HPP +#define ELEMENT_GRAPH_HPP + +#include <map> +#include <set> +#include <vector> +#include <string> +#include <memory> + +#include <iostream> + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + template <typename N, typename E> + class Graph + { + public: + ~Graph (); + + public: + template <typename T> + T& + new_node (); + + template <typename T, typename A0> + T& + new_node (A0 const& a0); + + template <typename T, typename A0, typename A1> + T& + new_node (A0 const& a0, A1 const& a1); + + template <typename T, typename A0, typename A1, typename A2> + T& + new_node (A0 const& a0, A1 const& a1, A2 const& a2); + + template <typename T, + typename A0, + typename A1, + typename A2, + typename A3> + T& + new_node (A0 const& a0, A1 const& a1, A2 const& a2, A3 const& a3); + + void + delete_node (N const& n); + + public: + template <typename T, typename X, typename Y> + T& + new_edge (X& left, Y& right); + + template <typename T, typename X, typename Y, + typename A0> + T& + new_edge (X& left, Y& right, A0 const& a0); + + template <typename T, typename X, typename Y, + typename A0, + typename A1> + T& + new_edge (X& left, Y& right, A0 const& a0, A1 const& a1); + + void + delete_edge (E const& e); + + protected: + typedef N* NodePtr; + typedef E* EdgePtr; + + typedef std::set<NodePtr> Nodes_; + typedef std::set<EdgePtr> Edges_; + + Nodes_ nodes_; + Edges_ edges_; + }; + } + } +} + +#include "Graph.tpp" + +#endif // ELEMENT_GRAPH_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.tpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.tpp new file mode 100644 index 00000000000..37a952a3f34 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.tpp @@ -0,0 +1,188 @@ +// file : CCF/IDL2/SemanticGraph/Graph.tpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // Graph + // + // + + + template <typename N, typename E> + template <typename T> + T& Graph<N, E>:: + new_node () + { + T* n (new T); //@@ auto + nodes_.insert (n); + return *n; + } + + + template <typename N, typename E> + template <typename T, typename A0> + T& Graph<N, E>:: + new_node (A0 const& a0) + { + T* n (new T (a0)); //@@ auto + nodes_.insert (n); + return *n; + } + + + template <typename N, typename E> + template <typename T, typename A0, typename A1> + T& Graph<N, E>:: + new_node (A0 const& a0, A1 const& a1) + { + T* n (new T (a0, a1)); //@@ auto + nodes_.insert (n); + return *n; + } + + template <typename N, typename E> + template <typename T, typename A0, typename A1, typename A2> + T& Graph<N, E>:: + new_node (A0 const& a0, A1 const& a1, A2 const& a2) + { + T* n (new T (a0, a1, a2)); //@@ auto + nodes_.insert (n); + return *n; + } + + template <typename N, typename E> + template <typename T, + typename A0, + typename A1, + typename A2, + typename A3> + T& Graph<N, E>:: + new_node (A0 const& a0, A1 const& a1, A2 const& a2, A3 const& a3) + { + T* n (new T (a0, a1, a2, a3)); //@@ auto + nodes_.insert (n); + return *n; + } + + + template <typename N, typename E> + void Graph<N, E>:: + delete_node (N const& nr) + { + N* n (&nr); + + for (E* e (n->remove_edge_ ()); e != 0; e = n->remove_edge_ ()) + { + // One endpoint of the edge has removed this edge from + // its edge set. Now handle the other endpoint. + // + if (e->left_ () == n) e->right_ ()->remove_edge_ (e); + else e->left_ ()->remove_edge_ (e); + + // Delete the edge. + // + edges_.erase (e); + + delete e; //@@ auto + } + + nodes_.erase (n); + + delete n; //@@ auto + } + + + template <typename N, typename E> + template <typename T, typename X, typename Y> + T& Graph<N, E>:: + new_edge (X& left, Y& right) + { + T* e (new T); //@@ auto + + e->set_left_node (left); + e->set_right_node (right); + + left.add_edge_left (*e); + right.add_edge_right (*e); + + edges_.insert (e); + + return *e; + } + + template <typename N, typename E> + template <typename T, typename X, typename Y, + typename A0> + T& Graph<N, E>:: + new_edge (X& left, Y& right, A0 const& a0) + { + T* e (new T (a0)); //@@ auto + + e->set_left_node (left); + e->set_right_node (right); + + left.add_edge_left (*e); + right.add_edge_right (*e); + + edges_.insert (e); + + return *e; + } + + template <typename N, typename E> + template <typename T, typename X, typename Y, + typename A0, + typename A1> + T& Graph<N, E>:: + new_edge (X& left, Y& right, A0 const& a0, A1 const& a1) + { + T* e (new T (a0, a1)); //@@ auto + + e->set_left_node (left); + e->set_right_node (right); + + left.add_edge_left (*e); + right.add_edge_right (*e); + + edges_.insert (e); + + return *e; + } + + template <typename N, typename E> + void Graph<N, E>:: + delete_edge (E const& er) + { + E* e (&er); + + e->left_ ()->remove_edge_ (e); + e->right_ ()->remove_edge_ (e); + + edges_.erase (e); + + delete e; //@@ auto + } + + + template <typename N, typename E> + Graph<N, E>:: + ~Graph () + { + //@@ auto + + for (typename Edges_::iterator i (edges_.begin ()), end (edges_.end ()); + i != end; + ++i) delete *i; + + for (typename Nodes_::iterator i (nodes_.begin ()), end (nodes_.end ()); + i != end; + ++i) delete *i; + } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.cpp new file mode 100644 index 00000000000..a6633df762b --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.cpp @@ -0,0 +1,486 @@ +// file : CCF/IDL2/SemanticGraph/IntExpression.cpp +// author : Boris Kolpackov <boris@kolpackov.net> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/IntExpression.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // IntExpression + // + namespace + { + TypeInfo + int_expression_init_ () + { + TypeInfo ti (typeid (IntExpression)); + ti.add_base (Access::PUBLIC, true, Expression::static_type_info ()); + return ti; + } + + TypeInfo int_expression_ (int_expression_init_ ()); + } + + TypeInfo const& IntExpression:: + static_type_info () { return int_expression_; } + + IntExpression:: + ~IntExpression () + { + } + + // IntLiteral + // + namespace + { + TypeInfo + int_literal_init_ () + { + TypeInfo ti (typeid (IntLiteral)); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_literal_ (int_literal_init_ ()); + } + + TypeInfo const& IntLiteral:: + static_type_info () { return int_literal_; } + + + // IntConst + // + namespace + { + TypeInfo + int_const_init_ () + { + TypeInfo ti (typeid (IntConst)); + ti.add_base (Access::PUBLIC, true, Const::static_type_info ()); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_const_ (int_const_init_ ()); + } + + TypeInfo const& IntConst:: + static_type_info () { return int_const_; } + + + // NEG + // + + namespace + { + TypeInfo + int_negates_init_ () + { + TypeInfo ti (typeid (IntNegates)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo int_negates_ (int_negates_init_ ()); + } + + TypeInfo const& IntNegates:: + static_type_info () { return int_negates_; } + + namespace + { + TypeInfo + int_neg_init_ () + { + TypeInfo ti (typeid (IntNeg)); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_neg_ (int_neg_init_ ()); + } + + TypeInfo const& IntNeg:: + static_type_info () { return int_neg_; } + + + // COM + // + + namespace + { + TypeInfo + int_complements_init_ () + { + TypeInfo ti (typeid (IntComplements)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo int_complements_ (int_complements_init_ ()); + } + + TypeInfo const& IntComplements:: + static_type_info () { return int_complements_; } + + namespace + { + TypeInfo + int_com_init_ () + { + TypeInfo ti (typeid (IntCom)); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_com_ (int_com_init_ ()); + } + + TypeInfo const& IntCom:: + static_type_info () { return int_com_; } + + + // MUL + // + + namespace + { + TypeInfo + int_multiplies_init_ () + { + TypeInfo ti (typeid (IntMultiplies)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo int_multiplies_ (int_multiplies_init_ ()); + } + + TypeInfo const& IntMultiplies:: + static_type_info () { return int_multiplies_; } + + namespace + { + TypeInfo + int_mul_init_ () + { + TypeInfo ti (typeid (IntMul)); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_mul_ (int_mul_init_ ()); + } + + TypeInfo const& IntMul:: + static_type_info () { return int_mul_; } + + + // DIV + // + + namespace + { + TypeInfo + int_divides_init_ () + { + TypeInfo ti (typeid (IntDivides)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo int_divides_ (int_divides_init_ ()); + } + + TypeInfo const& IntDivides:: + static_type_info () { return int_divides_; } + + namespace + { + TypeInfo + int_div_init_ () + { + TypeInfo ti (typeid (IntDiv)); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_div_ (int_div_init_ ()); + } + + TypeInfo const& IntDiv:: + static_type_info () { return int_div_; } + + namespace + { + TypeInfo + int_rem_init_ () + { + TypeInfo ti (typeid (IntRem)); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_rem_ (int_rem_init_ ()); + } + + TypeInfo const& IntRem:: + static_type_info () { return int_rem_; } + + + // ADD + // + + namespace + { + TypeInfo + int_adds_init_ () + { + TypeInfo ti (typeid (IntAdds)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo int_adds_ (int_adds_init_ ()); + } + + TypeInfo const& IntAdds:: + static_type_info () { return int_adds_; } + + namespace + { + TypeInfo + int_add_init_ () + { + TypeInfo ti (typeid (IntAdd)); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_add_ (int_add_init_ ()); + } + + TypeInfo const& IntAdd:: + static_type_info () { return int_add_; } + + + // SUB + // + + namespace + { + TypeInfo + int_subtracts_init_ () + { + TypeInfo ti (typeid (IntSubtracts)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo int_subtracts_ (int_subtracts_init_ ()); + } + + TypeInfo const& IntSubtracts:: + static_type_info () { return int_subtracts_; } + + namespace + { + TypeInfo + int_sub_init_ () + { + TypeInfo ti (typeid (IntSub)); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_sub_ (int_sub_init_ ()); + } + + TypeInfo const& IntSub:: + static_type_info () { return int_sub_; } + + + // RSH & LSH + // + + namespace + { + TypeInfo + int_shifts_init_ () + { + TypeInfo ti (typeid (IntShifts)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo int_shifts_ (int_shifts_init_ ()); + } + + TypeInfo const& IntShifts:: + static_type_info () { return int_shifts_; } + + namespace + { + TypeInfo + int_rsh_init_ () + { + TypeInfo ti (typeid (IntRsh)); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_rsh_ (int_rsh_init_ ()); + } + + TypeInfo const& IntRsh:: + static_type_info () { return int_rsh_; } + + namespace + { + TypeInfo + int_lsh_init_ () + { + TypeInfo ti (typeid (IntLsh)); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_lsh_ (int_lsh_init_ ()); + } + + TypeInfo const& IntLsh:: + static_type_info () { return int_lsh_; } + + + // AND + // + + namespace + { + TypeInfo + int_conjuncts_init_ () + { + TypeInfo ti (typeid (IntConjuncts)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo int_conjuncts_ (int_conjuncts_init_ ()); + } + + TypeInfo const& IntConjuncts:: + static_type_info () { return int_conjuncts_; } + + namespace + { + TypeInfo + int_and_init_ () + { + TypeInfo ti (typeid (IntAnd)); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_and_ (int_and_init_ ()); + } + + TypeInfo const& IntAnd:: + static_type_info () { return int_and_; } + + + // XOR + // + + namespace + { + TypeInfo + int_exclusively_disjuncts_init_ () + { + TypeInfo ti (typeid (IntExclusivelyDisjuncts)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo int_exclusively_disjuncts_ ( + int_exclusively_disjuncts_init_ ()); + } + + TypeInfo const& IntExclusivelyDisjuncts:: + static_type_info () { return int_exclusively_disjuncts_; } + + namespace + { + TypeInfo + int_xor_init_ () + { + TypeInfo ti (typeid (IntXor)); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_xor_ (int_xor_init_ ()); + } + + TypeInfo const& IntXor:: + static_type_info () { return int_xor_; } + + + // OR + // + + namespace + { + TypeInfo + int_inclusively_disjuncts_init_ () + { + TypeInfo ti (typeid (IntInclusivelyDisjuncts)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo int_inclusively_disjuncts_ ( + int_inclusively_disjuncts_init_ ()); + } + + TypeInfo const& IntInclusivelyDisjuncts:: + static_type_info () { return int_inclusively_disjuncts_; } + + namespace + { + TypeInfo + int_or_init_ () + { + TypeInfo ti (typeid (IntOr)); + ti.add_base ( + Access::PUBLIC, true, IntExpression::static_type_info ()); + return ti; + } + + TypeInfo int_or_ (int_or_init_ ()); + } + + TypeInfo const& IntOr:: + static_type_info () { return int_or_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.hpp new file mode 100644 index 00000000000..263563e9bb6 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.hpp @@ -0,0 +1,1013 @@ +// file : CCF/IDL2/SemanticGraph/IntExpression.hpp +// author : Boris Kolpackov <boris@kolpackov.net> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_INT_EXPRESSION_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_INT_EXPRESSION_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // + // + class IntExpression: public virtual Expression + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntExpression () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~IntExpression () = 0; + }; + + + // + // + class IntLiteral: public virtual IntExpression + { + public: + unsigned long long + value () const + { + return value_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntLiteral (Path const& path, + unsigned long line, + unsigned long long value) + : Node (path, line), value_ (value) + { + type_info (static_type_info ()); + } + + private: + unsigned long long value_; + }; + + + // + // + class IntConst: public virtual Const, + public virtual IntExpression + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntConst (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // NEG + // + + class IntNeg; + + class IntNegates: public virtual Edge + { + public: + IntExpression& + argument () const + { + return *argument_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntNegates () + { + type_info (static_type_info ()); + } + + void + set_left_node (IntNeg&) + { + } + + void + set_right_node (IntExpression& e) + { + argument_ = &e; + } + + private: + IntExpression* argument_; + }; + + + class IntNeg: public virtual IntExpression + { + public: + IntNegates& + negates () const + { + return *negates_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntNeg (Path const& path, unsigned long line) + : Node (path, line), negates_ (0) + { + type_info (static_type_info ()); + } + + void + add_edge_left (IntNegates& n) + { + negates_ = &n; + } + + private: + IntNegates* negates_; + }; + + + // COM + // + + class IntCom; + + class IntComplements: public virtual Edge + { + public: + IntExpression& + argument () const + { + return *argument_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntComplements () + { + type_info (static_type_info ()); + } + + void + set_left_node (IntCom&) + { + } + + void + set_right_node (IntExpression& e) + { + argument_ = &e; + } + + private: + IntExpression* argument_; + }; + + + class IntCom: public virtual IntExpression + { + public: + IntComplements& + complements () const + { + return *complements_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntCom (Path const& path, unsigned long line) + : Node (path, line), complements_ (0) + { + type_info (static_type_info ()); + } + + void + add_edge_left (IntComplements& n) + { + complements_ = &n; + } + + private: + IntComplements* complements_; + }; + + + // MUL + // + + class IntMul; + + class IntMultiplies: public virtual Edge + { + public: + IntExpression& + argument () const + { + return *argument_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntMultiplies () + { + type_info (static_type_info ()); + } + + void + set_left_node (IntMul&) + { + } + + void + set_right_node (IntExpression& e) + { + argument_ = &e; + } + + private: + IntExpression* argument_; + }; + + + class IntMul: public virtual IntExpression + { + public: + IntMultiplies& + first_factor () const + { + return *first_factor_; + } + + IntMultiplies& + second_factor () const + { + return *second_factor_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntMul (Path const& path, unsigned long line) + : Node (path, line), + first_factor_ (0), + second_factor_ (0) + { + type_info (static_type_info ()); + } + + void + add_edge_left (IntMultiplies& d) + { + if (first_factor_ == 0) + first_factor_ = &d; + else + second_factor_ = &d; + } + + private: + IntMultiplies* first_factor_; + IntMultiplies* second_factor_; + }; + + + // DIV & REM + // + + class IntDiv; + class IntRem; + + class IntDivides: public virtual Edge + { + public: + IntExpression& + argument () const + { + return *argument_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntDivides () + { + type_info (static_type_info ()); + } + + void + set_left_node (IntDiv&) + { + } + + void + set_left_node (IntRem&) + { + } + + void + set_right_node (IntExpression& e) + { + argument_ = &e; + } + + private: + IntExpression* argument_; + }; + + + class IntDiv: public virtual IntExpression + { + public: + IntDivides& + divident () const + { + return *divident_; + } + + IntDivides& + divisor () const + { + return *divisor_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntDiv (Path const& path, unsigned long line) + : Node (path, line), + divident_ (0), + divisor_ (0) + { + type_info (static_type_info ()); + } + + void + add_edge_left (IntDivides& d) + { + if (divident_ == 0) + divident_ = &d; + else + divisor_ = &d; + } + + private: + IntDivides* divident_; + IntDivides* divisor_; + }; + + class IntRem: public virtual IntExpression + { + public: + IntDivides& + divident () const + { + return *divident_; + } + + IntDivides& + divisor () const + { + return *divisor_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntRem (Path const& path, unsigned long line) + : Node (path, line), + divident_ (0), + divisor_ (0) + { + type_info (static_type_info ()); + } + + void + add_edge_left (IntDivides& d) + { + if (divident_ == 0) + divident_ = &d; + else + divisor_ = &d; + } + + private: + IntDivides* divident_; + IntDivides* divisor_; + }; + + + // ADD + // + + class IntAdd; + + class IntAdds: public virtual Edge + { + public: + IntExpression& + argument () const + { + return *argument_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntAdds () + { + type_info (static_type_info ()); + } + + void + set_left_node (IntAdd&) + { + } + + void + set_right_node (IntExpression& e) + { + argument_ = &e; + } + + private: + IntExpression* argument_; + }; + + + class IntAdd: public virtual IntExpression + { + public: + IntAdds& + first_item () const + { + return *first_item_; + } + + IntAdds& + second_item () const + { + return *second_item_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntAdd (Path const& path, unsigned long line) + : Node (path, line), + first_item_ (0), + second_item_ (0) + { + type_info (static_type_info ()); + } + + void + add_edge_left (IntAdds& d) + { + if (first_item_ == 0) + first_item_ = &d; + else + second_item_ = &d; + } + + private: + IntAdds* first_item_; + IntAdds* second_item_; + }; + + + // SUB + // + + class IntSub; + + class IntSubtracts: public virtual Edge + { + public: + IntExpression& + argument () const + { + return *argument_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntSubtracts () + { + type_info (static_type_info ()); + } + + void + set_left_node (IntSub&) + { + } + + void + set_right_node (IntExpression& e) + { + argument_ = &e; + } + + private: + IntExpression* argument_; + }; + + + class IntSub: public virtual IntExpression + { + public: + IntSubtracts& + minuend () const + { + return *minuend_; + } + + IntSubtracts& + subtrahend () const + { + return *subtrahend_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntSub (Path const& path, unsigned long line) + : Node (path, line), + minuend_ (0), + subtrahend_ (0) + { + type_info (static_type_info ()); + } + + void + add_edge_left (IntSubtracts& d) + { + if (minuend_ == 0) + minuend_ = &d; + else + subtrahend_ = &d; + } + + private: + IntSubtracts* minuend_; + IntSubtracts* subtrahend_; + }; + + + // RSH & LSH + // + + class IntRsh; + class IntLsh; + + class IntShifts: public virtual Edge + { + public: + IntExpression& + argument () const + { + return *argument_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntShifts () + { + type_info (static_type_info ()); + } + + void + set_left_node (IntRsh&) + { + } + + void + set_left_node (IntLsh&) + { + } + + void + set_right_node (IntExpression& e) + { + argument_ = &e; + } + + private: + IntExpression* argument_; + }; + + + class IntRsh: public virtual IntExpression + { + public: + IntShifts& + pattern () const + { + return *pattern_; + } + + IntShifts& + factor () const + { + return *factor_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntRsh (Path const& path, unsigned long line) + : Node (path, line), + pattern_ (0), + factor_ (0) + { + type_info (static_type_info ()); + } + + void + add_edge_left (IntShifts& d) + { + if (pattern_ == 0) + pattern_ = &d; + else + factor_ = &d; + } + + private: + IntShifts* pattern_; + IntShifts* factor_; + }; + + class IntLsh: public virtual IntExpression + { + public: + IntShifts& + pattern () const + { + return *pattern_; + } + + IntShifts& + factor () const + { + return *factor_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntLsh (Path const& path, unsigned long line) + : Node (path, line), + pattern_ (0), + factor_ (0) + { + type_info (static_type_info ()); + } + + void + add_edge_left (IntShifts& d) + { + if (pattern_ == 0) + pattern_ = &d; + else + factor_ = &d; + } + + private: + IntShifts* pattern_; + IntShifts* factor_; + }; + + + // AND + // + + class IntAnd; + + class IntConjuncts: public virtual Edge + { + public: + IntExpression& + argument () const + { + return *argument_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntConjuncts () + { + type_info (static_type_info ()); + } + + void + set_left_node (IntAnd&) + { + } + + void + set_right_node (IntExpression& e) + { + argument_ = &e; + } + + private: + IntExpression* argument_; + }; + + + class IntAnd: public virtual IntExpression + { + public: + IntConjuncts& + first_pattern () const + { + return *first_pattern_; + } + + IntConjuncts& + second_pattern () const + { + return *second_pattern_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntAnd (Path const& path, unsigned long line) + : Node (path, line), + first_pattern_ (0), + second_pattern_ (0) + { + type_info (static_type_info ()); + } + + void + add_edge_left (IntConjuncts& d) + { + if (first_pattern_ == 0) + first_pattern_ = &d; + else + second_pattern_ = &d; + } + + private: + IntConjuncts* first_pattern_; + IntConjuncts* second_pattern_; + }; + + + // XOR + // + + class IntXor; + + class IntExclusivelyDisjuncts: public virtual Edge + { + public: + IntExpression& + argument () const + { + return *argument_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntExclusivelyDisjuncts () + { + type_info (static_type_info ()); + } + + void + set_left_node (IntXor&) + { + } + + void + set_right_node (IntExpression& e) + { + argument_ = &e; + } + + private: + IntExpression* argument_; + }; + + + class IntXor: public virtual IntExpression + { + public: + IntExclusivelyDisjuncts& + first_pattern () const + { + return *first_pattern_; + } + + IntExclusivelyDisjuncts& + second_pattern () const + { + return *second_pattern_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntXor (Path const& path, unsigned long line) + : Node (path, line), + first_pattern_ (0), + second_pattern_ (0) + { + type_info (static_type_info ()); + } + + void + add_edge_left (IntExclusivelyDisjuncts& d) + { + if (first_pattern_ == 0) + first_pattern_ = &d; + else + second_pattern_ = &d; + } + + private: + IntExclusivelyDisjuncts* first_pattern_; + IntExclusivelyDisjuncts* second_pattern_; + }; + + + // OR + // + + class IntOr; + + class IntInclusivelyDisjuncts: public virtual Edge + { + public: + IntExpression& + argument () const + { + return *argument_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntInclusivelyDisjuncts () + { + type_info (static_type_info ()); + } + + void + set_left_node (IntOr&) + { + } + + void + set_right_node (IntExpression& e) + { + argument_ = &e; + } + + private: + IntExpression* argument_; + }; + + + class IntOr: public virtual IntExpression + { + public: + IntInclusivelyDisjuncts& + first_pattern () const + { + return *first_pattern_; + } + + IntInclusivelyDisjuncts& + second_pattern () const + { + return *second_pattern_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + IntOr (Path const& path, unsigned long line) + : Node (path, line), + first_pattern_ (0), + second_pattern_ (0) + { + type_info (static_type_info ()); + } + + void + add_edge_left (IntInclusivelyDisjuncts& d) + { + if (first_pattern_ == 0) + first_pattern_ = &d; + else + second_pattern_ = &d; + } + + private: + IntInclusivelyDisjuncts* first_pattern_; + IntInclusivelyDisjuncts* second_pattern_; + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_INT_EXPRESSION_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.cpp new file mode 100644 index 00000000000..4083549f3e2 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.cpp @@ -0,0 +1,122 @@ +// file : CCF/IDL2/SemanticGraph/Interface.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Interface.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + + // Interface + // + // + namespace + { + TypeInfo + interface_init_ () + { + TypeInfo ti (typeid (Interface)); + ti.add_base (Access::PUBLIC, true, Type::static_type_info ()); + ti.add_base (Access::PUBLIC, true, Scope::static_type_info ()); + return ti; + } + + TypeInfo interface_ (interface_init_ ()); + } + + TypeInfo const& Interface:: + static_type_info () { return interface_; } + + Interface:: + ~Interface () + { + } + + // Supports + // + // + namespace + { + TypeInfo + supports_init_ () + { + TypeInfo ti (typeid (Supports)); + ti.add_base (Access::PUBLIC, true, IsA::static_type_info ()); + return ti; + } + + TypeInfo supports_ (supports_init_ ()); + } + + TypeInfo const& Supports:: + static_type_info () { return supports_; } + + + // AbstractInterface + // + // + namespace + { + TypeInfo + abstract_interface_init_ () + { + TypeInfo ti (typeid (AbstractInterface)); + ti.add_base (Access::PUBLIC, true, Interface::static_type_info ()); + return ti; + } + + TypeInfo abstract_interface_ (abstract_interface_init_ ()); + } + + TypeInfo const& AbstractInterface:: + static_type_info () { return abstract_interface_; } + + + // LocalInterface + // + // + namespace + { + TypeInfo + local_interface_init_ () + { + TypeInfo ti (typeid (LocalInterface)); + ti.add_base (Access::PUBLIC, true, Interface::static_type_info ()); + return ti; + } + + TypeInfo local_interface_ (local_interface_init_ ()); + } + + TypeInfo const& LocalInterface:: + static_type_info () { return local_interface_; } + + + // UnconstrainedInterface + // + // + namespace + { + TypeInfo + unconstrained_interface_init_ () + { + TypeInfo ti (typeid (UnconstrainedInterface)); + ti.add_base (Access::PUBLIC, true, Interface::static_type_info ()); + return ti; + } + + TypeInfo unconstrained_interface_ (unconstrained_interface_init_ ()); + } + + TypeInfo const& UnconstrainedInterface:: + static_type_info () { return unconstrained_interface_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.hpp new file mode 100644 index 00000000000..1335b69a6cb --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.hpp @@ -0,0 +1,181 @@ +// file : CCF/IDL2/SemanticGraph/Interface.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_INTERFACE_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_INTERFACE_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/Operation.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // + // + // + class Interface : public virtual Type, public virtual Scope + { + typedef + std::vector <Inherits*> + Inherits_; + + public: + typedef + Inherits_::const_iterator + InheritsIterator; + + InheritsIterator + inherits_begin () const + { + return inherits_.begin (); + } + + InheritsIterator + inherits_end () const + { + return inherits_.end (); + } + + virtual bool + complete () const + { + return true; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Interface () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Interface () = 0; + + using Type::add_edge_right; + using Scope::add_edge_left; + + void + add_edge_left (Inherits& e) + { + inherits_.push_back (&e); + } + + void + add_edge_right (Inherits&) + { + } + + private: + Inherits_ inherits_; + }; + + + // + // + // + class Supports : public virtual IsA + { + public: + virtual Type& + supporter () const + { + return subject (); + } + + virtual Type& + supportee () const + { + return object (); + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Supports () + { + type_info (static_type_info ()); + } + + void + set_right_node (Interface& n) + { + IsA::set_right_node (n); + } + }; + + + // + // + // + class AbstractInterface : public virtual Interface + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + AbstractInterface (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class LocalInterface : public virtual Interface + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + LocalInterface (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class UnconstrainedInterface : public virtual Interface + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + UnconstrainedInterface (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_INTERFACE_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.cpp new file mode 100644 index 00000000000..86c64116b23 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.cpp @@ -0,0 +1,24 @@ +// file : CCF/IDL2/SemanticGraph/Literals.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Literals.hpp" + +#include <ostream> + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + } + } +} + +std::ostream& +operator<< (std::ostream& o, + CCF::IDL2::SemanticGraph::StringLiteral const& lit) +{ + return o << '\"' << lit.literal () << '\"'; +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.hpp new file mode 100644 index 00000000000..b2a350027db --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.hpp @@ -0,0 +1,56 @@ +// file : CCF/IDL2/SemanticGraph/Literals.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_LITERALS_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_LITERALS_HPP + +#include <string> +#include <iosfwd> + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // + // + // + class StringLiteral + { + public: + StringLiteral (std::string const& literal) + : literal_ (literal) + { + } + + std::string + literal () const + { + return literal_; + } + + private: + std::string literal_; + }; + + inline bool + operator== (StringLiteral const& a, StringLiteral const& b) + { + return a.literal () == b.literal (); + } + + inline bool + operator!= (StringLiteral const& a, StringLiteral const& b) + { + return a.literal () != b.literal (); + } + } + } +} + +std::ostream& +operator<< (std::ostream&, CCF::IDL2::SemanticGraph::StringLiteral const&); + +#endif // CCF_IDL2_SEMANTIC_GRAPH_LITERALS_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Member.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Member.cpp new file mode 100644 index 00000000000..597be660772 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Member.cpp @@ -0,0 +1,34 @@ +// file : CCF/IDL2/SemanticGraph/Member.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Member.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + namespace + { + TypeInfo + member_init_ () + { + TypeInfo ti (typeid (Member)); + ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ()); + ti.add_base (Access::PUBLIC, true, Instance::static_type_info ()); + return ti; + } + + TypeInfo member_ (member_init_ ()); + } + + TypeInfo const& Member:: + static_type_info () { return member_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Member.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Member.hpp new file mode 100644 index 00000000000..d37f5a5dd74 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Member.hpp @@ -0,0 +1,35 @@ +// file : CCF/IDL2/SemanticGraph/Member.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_MEMBER_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_MEMBER_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + class Member : public virtual Nameable, public virtual Instance + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Member (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_MEMBER_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Module.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Module.cpp new file mode 100644 index 00000000000..9e7aeb542e4 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Module.cpp @@ -0,0 +1,33 @@ +// file : CCF/IDL2/SemanticGraph/Module.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Module.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + namespace + { + TypeInfo + module_init_ () + { + TypeInfo ti (typeid (Module)); + ti.add_base (Access::PUBLIC, true, Scope::static_type_info ()); + return ti; + } + + TypeInfo module_ (module_init_ ()); + } + + TypeInfo const& Module:: + static_type_info () { return module_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Module.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Module.hpp new file mode 100644 index 00000000000..8807f2b55bc --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Module.hpp @@ -0,0 +1,35 @@ +// file : CCF/IDL2/SemanticGraph/Module.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_MODULE_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_MODULE_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + class Module : public virtual Scope + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Module (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_MODULE_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Name.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Name.cpp new file mode 100644 index 00000000000..374446661df --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Name.cpp @@ -0,0 +1,253 @@ +// file : CCF/IDL2/SemanticGraph/Name.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Name.hpp" + +#include <ostream> + +/* +#include <iostream> + +using std::cerr; +using std::endl; +*/ + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + + // SimpleName + // + // + + SimpleName:: + SimpleName (char const* name) throw (InvalidName) + : escaped_ (name[0] == '_'), + name_ (escaped_ ? name + 1 : name) + { + if (name_.find (':') != std::string::npos) + throw InvalidName (); + } + + SimpleName:: + SimpleName (std::string const& name) throw (InvalidName) + : escaped_ (name[0] == '_'), + name_ (name, escaped_ ? 1 : 0) + { + if (name_.find (':') != std::string::npos) + throw InvalidName (); + } + + SimpleName + operator+ (SimpleName const& name, std::string const& str) + { + return SimpleName (name.str () + str); + } + + SimpleName + operator+ (std::string const& str, SimpleName const& name) + { + return SimpleName (str + name.str ()); + } + + // Name + // + // + Name:: + Name (SimpleName const& name) + : name_cache_ (name.unescaped_str ()) + { + name_.push_back (name); + } + + Name:: + Name (char const* name) throw (InvalidName) + { + init (name); + } + + Name:: + Name (std::string const& name) throw (InvalidName) + { + init (name); + } + + void Name:: + init (std::string const& name) throw (InvalidName) + { + // cerr << "parsing name \'" << name_cache_ << "\' {"<< endl; + + for (std::string::size_type pos (0), next (name.find ("::", pos));; + next = name.find ("::", pos)) + { + std::string simple_name ( + name, + pos, + next == std::string::npos ? next : next - pos); + + // cerr << "\t\'" << simple_name << '\'' << endl; + + if (simple_name.empty () && !name_.empty ()) + { + // Empty name (file-scope) is only valid when + // it is first. + // + throw InvalidName (); + } + + name_.push_back (SimpleName (simple_name)); + name_cache_ += (pos != 0 ? "::" : "") + + name_.back ().unescaped_str (); + + if (next == std::string::npos) + break; + + pos = next + 2; + } + + // cerr << "parsing name }" << name_cache_ << endl; + + if (name_.empty ()) + throw InvalidName (); + } + + + Name:: + Name (Iterator begin, Iterator end) throw (InvalidName) + { + for (Iterator i (begin); i != end; ++i) + { + name_cache_ += (i != begin ? "::" : "") + i->unescaped_str (); + name_.push_back (*i); + } + + if (name_.empty ()) + throw InvalidName (); + } + + bool Name:: + scoped () const + { + return name_[0] == SimpleName (""); + } + + bool Name:: + simple () const + { + return name_.size () == 1; + } + + // ScopedName + // + // + + ScopedName:: + ScopedName (char const* name) throw (InvalidName) + : Name (name) + { + if (!scoped ()) throw InvalidName (); + } + + ScopedName:: + ScopedName (std::string const& name) throw (InvalidName) + : Name (name) + { + if (!scoped ()) throw InvalidName (); + } + + ScopedName:: + ScopedName (Iterator begin, Iterator end) throw (InvalidName) + : Name (begin, end) + { + if (!scoped ()) throw InvalidName (); + } + + ScopedName:: + ScopedName (Name const& name) throw (InvalidName) + : Name (name) + { + if (!scoped ()) throw InvalidName (); + } + + ScopedName:: + ScopedName (ScopedName const& scope, Name const& name) + throw (InvalidName) + : Name (scope.str () + "::" + name.str ()) + { + if (!scoped ()) throw InvalidName (); + } + + SimpleName ScopedName:: + simple_name () const + { + return *(end () - 1); + } + + ScopedName ScopedName:: + scope_name () const throw (FileScope) + { + Iterator end (this->end () - 1); + + if (begin () == end) throw FileScope (); + + return ScopedName (begin (), end); + } + + + // NamePrinter + // + int const name_printer_index = std::ios_base::xalloc (); + + NamePrinter::~NamePrinter () + { + } + + void NamePrinter:: + print (std::ostream& os, Name const& n) + { + for (Name::Iterator b (n.begin ()), i (b); i != n.end (); ++i) + { + if (i != b) + os << "::"; + + print (os, *i); + } + } + } + } +} + +std::ostream& +operator << (std::ostream& o, + CCF::IDL2::SemanticGraph::SimpleName const& name) +{ + using namespace CCF::IDL2::SemanticGraph; + + if (void* tmp = o.pword (name_printer_index)) + { + NamePrinter* p (reinterpret_cast<NamePrinter*> (tmp)); + p->print (o, name); + return o; + } + else + return o << name.str (); +} + +std::ostream& +operator << (std::ostream& o, CCF::IDL2::SemanticGraph::Name const& name) +{ + using namespace CCF::IDL2::SemanticGraph; + + if (void* tmp = o.pword (name_printer_index)) + { + NamePrinter* p (reinterpret_cast<NamePrinter*> (tmp)); + p->print (o, name); + return o; + } + else + return o << name.str (); +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Name.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Name.hpp new file mode 100644 index 00000000000..50dd752aa6a --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Name.hpp @@ -0,0 +1,239 @@ +// file : CCF/IDL2/SemanticGraph/Name.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_NAME_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_NAME_HPP + +#include <vector> +#include <string> +#include <iosfwd> + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + //@@ better names for names: maybe SimpleName, ScopedName, FullName? + // + // + + class InvalidName {}; + + class SimpleName + { + public: + SimpleName (char const* name) throw (InvalidName); + SimpleName (std::string const& name) throw (InvalidName); + + public: + // Comparisons are escape-insensitive. + // + bool + operator< (SimpleName const& other) const + { + return name_ < other.name_; + } + + bool + operator== (SimpleName const& other) const + { + return name_ == other.name_; + } + + bool + operator!= (SimpleName const& other) const + { + return name_ != other.name_; + } + + public: + bool + escaped () const + { + return escaped_; + } + + std::string + str () const + { + return (escaped_ ? "_" : "") + name_; + } + + std::string + unescaped_str () const + { + return name_; + } + + private: + bool escaped_; + std::string name_; + }; + + // The following operators preserve escaping. + // + SimpleName + operator+ (SimpleName const& name, std::string const& str); + + SimpleName + operator+ (std::string const& str, SimpleName const& name); + + + // + // + // + class Name + { + typedef + std::vector<SimpleName> + Name_; + + public: + Name (SimpleName const& name); + + Name (char const* name) throw (InvalidName); + Name (std::string const& name) throw (InvalidName); + + typedef + Name_::const_iterator + Iterator; + + Name (Iterator begin, Iterator end) throw (InvalidName); + + public: + // Comparisons are escape-insensitive. + // + bool + operator< (Name const& other) const + { + return name_cache_ < other.name_cache_; + } + + bool + operator== (Name const& other) const + { + return name_cache_ == other.name_cache_; + } + + bool + operator!= (Name const& other) const + { + return name_cache_ != other.name_cache_; + } + + public: + Iterator + begin () const + { + return name_.begin (); + } + + Iterator + end () const + { + return name_.end (); + } + + public: + bool + scoped () const; + + bool + simple () const; + + public: + std::string + str () const + { + std::string r; + + for (Iterator b (begin ()), i (b), e (end ()); i != e; ++i) + r += (i != b ? "::" : "") + i->str (); + + return r; + } + + std::string + unescaped_str () const + { + return name_cache_; + } + + private: + void + init (std::string const& name) throw (InvalidName); + + private: + Name_ name_; + std::string name_cache_; // Unescaped name cache. + }; + + // Should always start with "::". Can be just "::" which + // means it's a file-scope. + // + // + class ScopedName : public Name + { + public: + ScopedName (char const* name) throw (InvalidName); + + ScopedName (std::string const& name) throw (InvalidName); + + ScopedName (Iterator begin, Iterator end) throw (InvalidName); + + explicit + ScopedName (Name const& name) throw (InvalidName); + + ScopedName (ScopedName const& scope, Name const& name) + throw (InvalidName); + + public: + SimpleName + simple_name () const; + + class FileScope {}; + + ScopedName + scope_name () const throw (FileScope); + }; + + + // Name printer index for the stream's pword. + // + extern int const name_printer_index; + + // + // + struct NamePrinter + { + virtual ~NamePrinter (); + + virtual void + print (std::ostream&, SimpleName const&) = 0; + + // The default implementation prints individul simple names + // using the print function above seperated by '::'. + // + virtual void + print (std::ostream&, Name const&); + + }; + } + } +} + +// Uses the name printer (see above) If it is installed, otherwise +// prints in the escaped form. +// +std::ostream& +operator << (std::ostream&, CCF::IDL2::SemanticGraph::SimpleName const&); + +// Uses the name printer (see above) If it is installed, otherwise +// prints in the escaped form. +// +std::ostream& +operator << (std::ostream& o, CCF::IDL2::SemanticGraph::Name const& name); + +#endif // CCF_IDL2_SEMANTIC_GRAPH_NAME_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.cpp new file mode 100644 index 00000000000..b2c29fe2881 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.cpp @@ -0,0 +1,33 @@ +// file : CCF/IDL2/SemanticGraph/Native.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Native.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + namespace + { + TypeInfo + native_init_ () + { + TypeInfo ti (typeid (Native)); + ti.add_base (Access::PUBLIC, true, Type::static_type_info ()); + return ti; + } + + TypeInfo native_ (native_init_ ()); + } + + TypeInfo const& Native:: + static_type_info () { return native_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.hpp new file mode 100644 index 00000000000..89c7b3f6a0e --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.hpp @@ -0,0 +1,41 @@ +// file : CCF/IDL2/SemanticGraph/Native.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_NATIVE_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_NATIVE_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + class Native : public virtual Type + { + public: + virtual bool + complete () const + { + return true; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Native (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_NATIVE_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.cpp new file mode 100644 index 00000000000..690f6d8173d --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.cpp @@ -0,0 +1,228 @@ +// file : CCF/IDL2/SemanticGraph/Operation.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Operation.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // Receives + // + // + namespace + { + TypeInfo + receives_init_ () + { + TypeInfo ti (typeid (Receives)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo receives_ (receives_init_ ()); + } + + TypeInfo const& Receives:: + static_type_info () { return receives_; } + + + // Returns + // + // + namespace + { + TypeInfo + returns_init_ () + { + TypeInfo ti (typeid (Returns)); + ti.add_base (Access::PUBLIC, true, Belongs::static_type_info ()); + return ti; + } + + TypeInfo returns_ (returns_init_ ()); + } + + TypeInfo const& Returns:: + static_type_info () { return returns_; } + + + // Raises + // + // + namespace + { + TypeInfo + raises_init_ () + { + TypeInfo ti (typeid (Raises)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo raises_ (raises_init_ ()); + } + + TypeInfo const& Raises:: + static_type_info () { return raises_; } + + + + // Parameter + // + // + namespace + { + TypeInfo + parameter_init_ () + { + TypeInfo ti (typeid (Parameter)); + ti.add_base (Access::PUBLIC, true, Instance::static_type_info ()); + return ti; + } + + TypeInfo parameter_ (parameter_init_ ()); + } + + TypeInfo const& Parameter:: + static_type_info () { return parameter_; } + + Parameter:: + ~Parameter () + { + } + + + // InParameter + // + // + namespace + { + TypeInfo + in_parameter_init_ () + { + TypeInfo ti (typeid (InParameter)); + ti.add_base (Access::PUBLIC, true, Parameter::static_type_info ()); + return ti; + } + + TypeInfo in_parameter_ (in_parameter_init_ ()); + } + + TypeInfo const& InParameter:: + static_type_info () { return in_parameter_; } + + + // OutParameter + // + // + namespace + { + TypeInfo + out_parameter_init_ () + { + TypeInfo ti (typeid (OutParameter)); + ti.add_base (Access::PUBLIC, true, Parameter::static_type_info ()); + return ti; + } + + TypeInfo out_parameter_ (out_parameter_init_ ()); + } + + TypeInfo const& OutParameter:: + static_type_info () { return out_parameter_; } + + + // InOutParameter + // + // + namespace + { + TypeInfo + in_out_parameter_init_ () + { + TypeInfo ti (typeid (InOutParameter)); + ti.add_base (Access::PUBLIC, true, Parameter::static_type_info ()); + return ti; + } + + TypeInfo in_out_parameter_ (in_out_parameter_init_ ()); + } + + TypeInfo const& InOutParameter:: + static_type_info () { return in_out_parameter_; } + + + // Operation + // + // + namespace + { + TypeInfo + operation_init_ () + { + TypeInfo ti (typeid (Operation)); + ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ()); + ti.add_base (Access::PUBLIC, true, Instance::static_type_info ()); + return ti; + } + + TypeInfo operation_ (operation_init_ ()); + } + + TypeInfo const& Operation:: + static_type_info () { return operation_; } + + Operation:: + ~Operation () + { + } + + + // OneWayOperation + // + // + namespace + { + TypeInfo + one_way_operation_init_ () + { + TypeInfo ti (typeid (OneWayOperation)); + ti.add_base (Access::PUBLIC, true, Operation::static_type_info ()); + return ti; + } + + TypeInfo one_way_operation_ (one_way_operation_init_ ()); + } + + TypeInfo const& OneWayOperation:: + static_type_info () { return one_way_operation_; } + + + // TwoWayOperation + // + // + namespace + { + TypeInfo + two_way_operation_init_ () + { + TypeInfo ti (typeid (TwoWayOperation)); + ti.add_base (Access::PUBLIC, true, Operation::static_type_info ()); + return ti; + } + + TypeInfo two_way_operation_ (two_way_operation_init_ ()); + } + + TypeInfo const& TwoWayOperation:: + static_type_info () { return two_way_operation_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.hpp new file mode 100644 index 00000000000..2f0a5d1686a --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.hpp @@ -0,0 +1,359 @@ +// file : CCF/IDL2/SemanticGraph/Operation.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_OPERATION_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_OPERATION_HPP + +#include <string> + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/Exception.hpp" +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + class Operation; + class Parameter; + + // Operation receives parameter + // + // + class Receives : public virtual Edge + { + public: + Operation& + operation () const + { + return *operation_; + } + + Parameter& + parameter () const + { + return *parameter_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Receives () + { + type_info (static_type_info ()); + } + + void + set_left_node (Operation& n) + { + operation_ = &n; + } + + void + set_right_node (Parameter& n) + { + parameter_ = &n; + } + + private: + Operation* operation_; + Parameter* parameter_; + }; + + + // Operation returns + // + // + class Returns : public virtual Belongs + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Returns () + { + type_info (static_type_info ()); + } + }; + + + // Raises + // + // + class Raises : public virtual Edge + { + public: + Operation& + operation () const + { + return *operation_; + } + + Exception& + exception () const + { + return *exception_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Raises () + { + type_info (static_type_info ()); + } + + void + set_left_node (Operation& n) + { + operation_ = &n; + } + + void + set_right_node (Exception& n) + { + exception_ = &n; + } + + private: + Operation* operation_; + Exception* exception_; + }; + + + // + // + // + class Parameter : public virtual Instance + { + public: + std::string + name () const + { + return name_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Parameter (std::string const& name) // For virtual inheritance only. + : name_ (name) + { + type_info (static_type_info ()); + } + + virtual + ~Parameter () = 0; + + void + add_edge_right (Receives&) + { + } + + private: + std::string name_; + }; + + + class InParameter : public virtual Parameter + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + InParameter (Path const& path, + unsigned long line, + std::string const& name) + : Node (path, line), Parameter (name) + { + type_info (static_type_info ()); + } + }; + + class OutParameter : public virtual Parameter + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + OutParameter (Path const& path, + unsigned long line, + std::string const& name) + : Node (path, line), Parameter (name) + { + type_info (static_type_info ()); + } + }; + + class InOutParameter : public virtual Parameter + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + InOutParameter (Path const& path, + unsigned long line, + std::string const& name) + : Node (path, line), Parameter (name) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class Operation : public virtual Nameable, public virtual Instance + { + typedef + std::vector<Receives*> + Receives_; + + typedef + std::vector<Raises*> + Raises_; + + public: + typedef + Receives_::const_iterator + ReceivesIterator; + + ReceivesIterator + receives_begin () const + { + return receives_.begin (); + } + + ReceivesIterator + receives_end () const + { + return receives_.end (); + } + + typedef + Raises_::const_iterator + RaisesIterator; + + RaisesIterator + raises_begin () const + { + return raises_.begin (); + } + + RaisesIterator + raises_end () const + { + return raises_.end (); + } + + Returns& + returns () const + { + return dynamic_cast<Returns&> (belongs ()); + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Operation () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Operation () = 0; + + + void + add_edge_left (Receives& e) + { + receives_.push_back (&e); + } + + void + add_edge_left (Raises& e) + { + raises_.push_back (&e); + } + + void + add_edge_left (Returns& e) + { + Instance::add_edge_left (e); + } + + private: + Receives_ receives_; + Raises_ raises_; + }; + + + // + // + // + class OneWayOperation : public virtual Operation + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + OneWayOperation (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class TwoWayOperation : public virtual Operation + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + TwoWayOperation (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_OPERATION_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.cpp new file mode 100644 index 00000000000..5c95be2c67c --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.cpp @@ -0,0 +1,82 @@ +// file : CCF/IDL2/SemanticGraph/Sequence.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Sequence.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // Sequence + // + // + namespace + { + TypeInfo + sequence_init_ () + { + TypeInfo ti (typeid (Sequence)); + ti.add_base ( + Access::PUBLIC, true, Specialization::static_type_info ()); + return ti; + } + + TypeInfo sequence_ (sequence_init_ ()); + } + + TypeInfo const& Sequence:: + static_type_info () { return sequence_; } + + Sequence:: + ~Sequence () + { + } + + + // UnboundedSequence + // + // + namespace + { + TypeInfo + unbounded_sequence_init_ () + { + TypeInfo ti (typeid (UnboundedSequence)); + ti.add_base (Access::PUBLIC, true, Sequence::static_type_info ()); + return ti; + } + + TypeInfo unbounded_sequence_ (unbounded_sequence_init_ ()); + } + + TypeInfo const& UnboundedSequence:: + static_type_info () { return unbounded_sequence_; } + + + // BoundedSequence + // + // + namespace + { + TypeInfo + bounded_sequence_init_ () + { + TypeInfo ti (typeid (BoundedSequence)); + ti.add_base (Access::PUBLIC, true, Sequence::static_type_info ()); + return ti; + } + + TypeInfo bounded_sequence_ (bounded_sequence_init_ ()); + } + + TypeInfo const& BoundedSequence:: + static_type_info () { return bounded_sequence_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.hpp new file mode 100644 index 00000000000..333b55fed2a --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.hpp @@ -0,0 +1,106 @@ +// file : CCF/IDL2/SemanticGraph/Sequence.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_SEQUENCE_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_SEQUENCE_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/IntExpression.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // + // + // + class Sequence : public virtual Specialization + { + public: + Type& + type () const + { + return + dynamic_cast<ArgumentsWithType&> (**arguments_begin ()).type (); + } + + virtual bool + complete () const + { + return type ().complete (); + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Sequence () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Sequence () = 0; + }; + + + // + // + // + class UnboundedSequence : public virtual Sequence + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + UnboundedSequence (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class BoundedSequence : public virtual Sequence + { + public: + IntExpression& + bound () const + { + ArgumentsIterator i (arguments_begin ()); + + ++i; // Bound is always second to the type. + + return + dynamic_cast<IntExpression&> ( + dynamic_cast<ArgumentsWithValue&> (**i).value ()); + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + BoundedSequence (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_SEQUENCE_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/String.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/String.cpp new file mode 100644 index 00000000000..578c87361d4 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/String.cpp @@ -0,0 +1,58 @@ +// file : CCF/IDL2/SemanticGraph/String.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/String.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // BoundedString + // + // + namespace + { + TypeInfo + bounded_string_init_ () + { + TypeInfo ti (typeid (BoundedString)); + ti.add_base ( + Access::PUBLIC, true, Specialization::static_type_info ()); + return ti; + } + + TypeInfo bounded_string_ (bounded_string_init_ ()); + } + + TypeInfo const& BoundedString:: + static_type_info () { return bounded_string_; } + + + // BoundedWideString + // + // + namespace + { + TypeInfo + bounded_wide_string_init_ () + { + TypeInfo ti (typeid (BoundedWideString)); + ti.add_base ( + Access::PUBLIC, true, Specialization::static_type_info ()); + return ti; + } + + TypeInfo bounded_wide_string_ (bounded_wide_string_init_ ()); + } + + TypeInfo const& BoundedWideString:: + static_type_info () { return bounded_wide_string_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/String.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/String.hpp new file mode 100644 index 00000000000..484a8a778ec --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/String.hpp @@ -0,0 +1,87 @@ +// file : CCF/IDL2/SemanticGraph/String.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_STRING_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_STRING_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/IntExpression.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // + // + class BoundedString : public virtual Specialization + { + public: + IntExpression& + bound () const + { + return + dynamic_cast<IntExpression&> ( + dynamic_cast<ArgumentsWithValue&> ( + **arguments_begin ()).value ()); + } + + virtual bool + complete () const + { + return true; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + BoundedString (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + class BoundedWideString : public virtual Specialization + { + public: + IntExpression& + bound () const + { + return + dynamic_cast<IntExpression&> ( + dynamic_cast<ArgumentsWithValue&> ( + **arguments_begin ()).value ()); + } + + virtual bool + complete () const + { + return true; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + BoundedWideString (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_STRING_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.cpp new file mode 100644 index 00000000000..46fd9b9ef3a --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.cpp @@ -0,0 +1,67 @@ +// file : CCF/IDL2/SemanticGraph/Struct.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Struct.hpp" +#include "CCF/IDL2/SemanticGraph/Member.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + namespace + { + TypeInfo + struct_init_ () + { + TypeInfo ti (typeid (Struct)); + ti.add_base (Access::PUBLIC, true, Type::static_type_info ()); + ti.add_base (Access::PUBLIC, true, Scope::static_type_info ()); + return ti; + } + + TypeInfo struct_ (struct_init_ ()); + } + + TypeInfo const& Struct:: + static_type_info () { return struct_; } + + bool Struct:: + complete () const + { + if (defined ()) + { + CompilerElements::Context& ctx ( + const_cast<CompilerElements::Context&> (context ())); + + if (ctx.count ("struct-complete-test")) + return true; + + ctx.set ("struct-complete-test", true); + bool c (true); + + for (Scope::NamesIterator i (names_begin ()); + c && i != names_end (); + ++i) + { + Member const& m (dynamic_cast<Member&> ((*i)->named ())); + Type const& t (m.belongs ().type ()); + + if (!t.complete ()) + c = false; + } + + ctx.remove ("struct-complete-test"); + return c; + } + + return false; + } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.hpp new file mode 100644 index 00000000000..5e186bfd0ff --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.hpp @@ -0,0 +1,41 @@ +// file : CCF/IDL2/SemanticGraph/Struct.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_STRUCT_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_STRUCT_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + class Struct : public virtual Type, public virtual Scope + { + public: + virtual bool + complete () const; + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Struct (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + + using Type::add_edge_right; + using Scope::add_edge_left; + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_STRUCT_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.cpp new file mode 100644 index 00000000000..b925da62259 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.cpp @@ -0,0 +1,255 @@ +// file : CCF/IDL2/SemanticGraph/Translation.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Translation.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // ContainsPrincipal + // + // + namespace + { + TypeInfo + contains_principal_init_ () + { + TypeInfo ti (typeid (ContainsPrincipal)); + ti.add_base (Access::PUBLIC, true, Contains::static_type_info ()); + return ti; + } + + TypeInfo contains_principal_ (contains_principal_init_ ()); + } + + TypeInfo const& ContainsPrincipal:: + static_type_info () { return contains_principal_; } + + + // ContainsImplied + // + // + namespace + { + TypeInfo + contains_implied_init_ () + { + TypeInfo ti (typeid (ContainsImplied)); + ti.add_base (Access::PUBLIC, true, Contains::static_type_info ()); + return ti; + } + + TypeInfo contains_implied_ (contains_implied_init_ ()); + } + + TypeInfo const& ContainsImplied:: + static_type_info () { return contains_implied_; } + + + // ContainsRoot + // + // + namespace + { + TypeInfo + contains_root_init_ () + { + TypeInfo ti (typeid (ContainsRoot)); + ti.add_base (Access::PUBLIC, true, Contains::static_type_info ()); + return ti; + } + + TypeInfo contains_root_ (contains_root_init_ ()); + } + + TypeInfo const& ContainsRoot:: + static_type_info () { return contains_root_; } + + + // Includes + // + // + namespace + { + TypeInfo + includes_init_ () + { + TypeInfo ti (typeid (Includes)); + ti.add_base (Access::PUBLIC, true, Contains::static_type_info ()); + return ti; + } + + TypeInfo includes_ (includes_init_ ()); + } + + TypeInfo const& Includes:: + static_type_info () { return includes_; } + + + // QuoteIncludes + // + // + namespace + { + TypeInfo + quote_includes_init_ () + { + TypeInfo ti (typeid (QuoteIncludes)); + ti.add_base (Access::PUBLIC, true, Includes::static_type_info ()); + return ti; + } + + TypeInfo quote_includes_ (quote_includes_init_ ()); + } + + TypeInfo const& QuoteIncludes:: + static_type_info () { return quote_includes_; } + + + + // BracketIncludes + // + // + namespace + { + TypeInfo + bracket_includes_init_ () + { + TypeInfo ti (typeid (BracketIncludes)); + ti.add_base (Access::PUBLIC, true, Includes::static_type_info ()); + return ti; + } + + TypeInfo bracket_includes_ (bracket_includes_init_ ()); + } + + TypeInfo const& BracketIncludes:: + static_type_info () { return bracket_includes_; } + + + // Root + // + // + namespace + { + TypeInfo + root_init_ () + { + TypeInfo ti (typeid (Root)); + ti.add_base (Access::PUBLIC, true, Scope::static_type_info ()); + return ti; + } + + TypeInfo root_ (root_init_ ()); + } + + TypeInfo const& Root:: + static_type_info () { return root_; } + + + // TranslationRegion + // + // + + Nameables TranslationRegion:: + lookup (ScopedName const& name) const + { + Nameables r; + lookup (name, r); + return r; + } + + void TranslationRegion:: + lookup (ScopedName const& name, Nameables& result) const + { + bool root (name.simple ()); + + Name rest (name.begin () + (root ? 0 : 1), name.end ()); + + for (ContainsIterator i (contains_begin ()), end (contains_end ()); + i != end; ++i) + { + Node& node ((**i).element ()); + + if (Root* r = dynamic_cast<Root*> (&node)) + { + if (root) + { + result.insert (r); + } + else + { + r->lookup (rest, result); + } + } + else + { + dynamic_cast<TranslationRegion&> (node).lookup (name, result); + } + } + } + + + namespace + { + TypeInfo + translation_region_init_ () + { + TypeInfo ti (typeid (TranslationRegion)); + ti.add_base (Access::PUBLIC, true, Container::static_type_info ()); + return ti; + } + + TypeInfo translation_region_ (translation_region_init_ ()); + } + + TypeInfo const& TranslationRegion:: + static_type_info () { return translation_region_; } + + + // TranslationUnit + // + // + + Nameables TranslationUnit:: + lookup (ScopedName const& name) const + { + Nameables r; + + for (ContainsIterator i (contains_begin ()), end (contains_end ()); + i != end; ++i) + { + TranslationRegion& tr ( + dynamic_cast<TranslationRegion&>((**i).element ())); + + tr.lookup (name, r); + } + + return r; + } + + namespace + { + TypeInfo + translation_unit_init_ () + { + TypeInfo ti (typeid (TranslationUnit)); + ti.add_base (Access::PUBLIC, true, Container::static_type_info ()); + return ti; + } + + TypeInfo translation_unit_ (translation_unit_init_ ()); + } + + TypeInfo const& TranslationUnit:: + static_type_info () { return translation_unit_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.hpp new file mode 100644 index 00000000000..42df2ed2c13 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.hpp @@ -0,0 +1,287 @@ +// file : CCF/IDL2/SemanticGraph/Translation.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_TRANSLATION_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_TRANSLATION_HPP + +#include <vector> +#include <string> + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + class Root; + class TranslationRegion; + class TranslationUnit; + + + // + // + // + class ContainsPrincipal : public virtual Contains + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ContainsPrincipal () + { + type_info (static_type_info ()); + } + + void + set_left_node (TranslationUnit& n); + + void + set_right_node (TranslationRegion& n); + }; + + + // + // + // + class ContainsImplied : public virtual Contains + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ContainsImplied (std::string const& name = "") + : name_ (name) + { + type_info (static_type_info ()); + } + + void + set_left_node (TranslationUnit& n); + + void + set_right_node (TranslationRegion& n); + + private: + std::string name_; + }; + + + // + // + // + class ContainsRoot : public virtual Contains + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ContainsRoot () + { + type_info (static_type_info ()); + } + + void + set_left_node (TranslationRegion& n); + + void + set_right_node (Root& n); + }; + + // + // + // + class Includes : public virtual Contains + { + public: + Path + file () const + { + return file_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Includes (Path const& file) + : file_ (file) + { + type_info (static_type_info ()); + } + + void + set_left_node (TranslationRegion& n); + + void + set_right_node (TranslationRegion& n); + + private: + Path file_; + }; + + + // + // + // + class QuoteIncludes : public virtual Includes + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + QuoteIncludes (Path const& file) + : Includes (file) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class BracketIncludes : public virtual Includes + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + BracketIncludes (Path const& file) + : Includes (file) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class Root : public virtual Scope + { + public: + virtual SimpleName + name () const + { + return SimpleName (""); + } + + virtual ScopedName + scoped_name () const + { + return ScopedName (""); + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Root (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + + void + add_edge_right (Contains&) + { + // TranslationRegion contains Root + } + }; + + + // + // + // + class TranslationRegion : public virtual Container + { + public: + Nameables + lookup (ScopedName const& name) const; + + void + lookup (ScopedName const& name, Nameables& result) const; + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + TranslationRegion (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + + void + add_edge_right (Contains&) + { + } + }; + + + class TranslationUnit : public virtual Container, + public Graph<Node, Edge> + { + public: + TranslationUnit (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + + Nameables + lookup (ScopedName const& name) const; + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + void + add_edge_left (ContainsPrincipal& e) + { + Container::add_edge_left (e); + } + + void + add_edge_left (ContainsImplied& e) + { + Container::add_edge_left (e); + } + + private: + TranslationUnit (TranslationUnit const&); + void operator= (TranslationUnit const&); + }; + } + } +} + +#include "CCF/IDL2/SemanticGraph/Translation.ipp" + +#endif // CCF_IDL2_SEMANTIC_GRAPH_TRANSLATION_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.ipp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.ipp new file mode 100644 index 00000000000..8168cd87762 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.ipp @@ -0,0 +1,73 @@ +// file : CCF/IDL2/SemanticGraph/Translation.ipp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // ContainsPrincipal + // + // + inline void ContainsPrincipal:: + set_left_node (TranslationUnit& n) + { + Contains::set_left_node (n); + } + + inline void ContainsPrincipal:: + set_right_node (TranslationRegion& n) + { + Contains::set_right_node (n); + } + + // ContainsImplied + // + // + inline void ContainsImplied:: + set_left_node (TranslationUnit& n) + { + Contains::set_left_node (n); + } + + inline void ContainsImplied:: + set_right_node (TranslationRegion& n) + { + Contains::set_right_node (n); + } + + // ContainsRoot + // + // + inline void ContainsRoot:: + set_left_node (TranslationRegion& n) + { + Contains::set_left_node (n); + } + + inline void ContainsRoot:: + set_right_node (Root& n) + { + Contains::set_right_node (n); + } + + + // Includes + // + // + inline void Includes:: + set_left_node (TranslationRegion& n) + { + Contains::set_left_node (n); + } + + inline void Includes:: + set_right_node (TranslationRegion& n) + { + Contains::set_right_node (n); + } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.cpp new file mode 100644 index 00000000000..7f7a1f69479 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.cpp @@ -0,0 +1,56 @@ +// file : CCF/IDL2/SemanticGraph/TypeId.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/TypeId.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // TypeId + // + // + namespace + { + TypeInfo + type_id_init_ () + { + TypeInfo ti (typeid (TypeId)); + ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ()); + return ti; + } + + TypeInfo type_id_ (type_id_init_ ()); + } + + TypeInfo const& TypeId:: + static_type_info () { return type_id_; } + + + // TypePrefix + // + // + namespace + { + TypeInfo + type_prefix_init_ () + { + TypeInfo ti (typeid (TypePrefix)); + ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ()); + return ti; + } + + TypeInfo type_prefix_ (type_prefix_init_ ()); + } + + TypeInfo const& TypePrefix:: + static_type_info () { return type_prefix_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.hpp new file mode 100644 index 00000000000..accb6f83226 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.hpp @@ -0,0 +1,104 @@ +// file : CCF/IDL2/SemanticGraph/TypeId.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_TYPE_ID_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_TYPE_ID_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/Literals.hpp" + + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // + // + // + class TypeId : public virtual Nameable + { + public: + //@@ declaration is a bad name. + // + ScopedName + declaration () const + { + return name_; + } + + StringLiteral + id () const + { + return id_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + TypeId (Path const& path, + unsigned long line, + ScopedName const& name, + StringLiteral const& id) + : Node (path, line), + name_ (name), + id_ (id) + { + type_info (static_type_info ()); + } + + private: + ScopedName name_; + StringLiteral id_; + }; + + + // + // + // + class TypePrefix : public virtual Nameable + { + public: + ScopedName + declaration () const + { + return name_; + } + + StringLiteral + prefix () const + { + return prefix_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + TypePrefix (Path const& path, + unsigned long line, + ScopedName const& name, + StringLiteral const& prefix) + : Node (path, line), + name_ (name), + prefix_ (prefix) + { + type_info (static_type_info ()); + } + + private: + ScopedName name_; + StringLiteral prefix_; + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_TYPE_ID_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.cpp new file mode 100644 index 00000000000..4fccb9a0ebc --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.cpp @@ -0,0 +1,177 @@ +// file : CCF/IDL2/SemanticGraph/Union.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Union.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + + // Selects + // + // + namespace + { + TypeInfo + selects_init_ () + { + TypeInfo ti (typeid (Selects)); + ti.add_base (Access::PUBLIC, true, Edge::static_type_info ()); + return ti; + } + + TypeInfo selects_ (selects_init_ ()); + } + + TypeInfo const& Selects:: + static_type_info () { return selects_; } + + + // UnionMember + // + // + namespace + { + TypeInfo + union_member_init_ () + { + TypeInfo ti (typeid (UnionMember)); + ti.add_base (Access::PUBLIC, true, Member::static_type_info ()); + return ti; + } + + TypeInfo union_member_ (union_member_init_ ()); + } + + TypeInfo const& UnionMember:: + static_type_info () { return union_member_; } + + + // Selector + // + // + namespace + { + TypeInfo + selector_init_ () + { + TypeInfo ti (typeid (Selector)); + ti.add_base (Access::PUBLIC, true, Node::static_type_info ()); + return ti; + } + + TypeInfo selector_ (selector_init_ ()); + } + + TypeInfo const& Selector:: + static_type_info () { return selector_; } + + Selector:: + ~Selector () + { + } + + // DefaultSelector + // + // + namespace + { + TypeInfo + default_selector_init_ () + { + TypeInfo ti (typeid (DefaultSelector)); + ti.add_base (Access::PUBLIC, true, Selector::static_type_info ()); + return ti; + } + + TypeInfo default_selector_ (default_selector_init_ ()); + } + + TypeInfo const& DefaultSelector:: + static_type_info () { return default_selector_; } + + + // ValueSelector + // + // + namespace + { + TypeInfo + value_selector_init_ () + { + TypeInfo ti (typeid (ValueSelector)); + ti.add_base (Access::PUBLIC, true, Selector::static_type_info ()); + ti.add_base (Access::PUBLIC, true, Instance::static_type_info ()); + return ti; + } + + TypeInfo value_selector_ (value_selector_init_ ()); + } + + TypeInfo const& ValueSelector:: + static_type_info () { return value_selector_; } + + // Union + // + // + namespace + { + TypeInfo + union_init_ () + { + TypeInfo ti (typeid (Union)); + + ti.add_base ( + Access::PUBLIC, true, Specialization::static_type_info ()); + + ti.add_base (Access::PUBLIC, true, Scope::static_type_info ()); + return ti; + } + + TypeInfo union_ (union_init_ ()); + } + + TypeInfo const& Union:: + static_type_info () { return union_; } + + bool Union:: + complete () const + { + if (defined ()) + { + CompilerElements::Context& ctx ( + const_cast<CompilerElements::Context&> (context ())); + + if (ctx.count ("union-complete-test")) + return true; + + ctx.set ("union-complete-test", true); + bool c (true); + + for (Scope::NamesIterator i (names_begin ()); + c && i != names_end (); + ++i) + { + Member const& m (dynamic_cast<Member&> ((*i)->named ())); + Type const& t (m.belongs ().type ()); + + if (!t.complete ()) + c = false; + } + + ctx.remove ("union-complete-test"); + return c; + } + + return false; + } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.hpp new file mode 100644 index 00000000000..2512358db03 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.hpp @@ -0,0 +1,158 @@ +// file : CCF/IDL2/SemanticGraph/Union.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_UNION_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_UNION_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/Member.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + class Selector; + class UnionMember; + + class Selects : public virtual Edge + { + public: + Selector& + selector () const + { + return *selector_; + } + + UnionMember& + member () const + { + return *member_; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Selects () + { + type_info (static_type_info ()); + } + + void + set_left_node (Selector& n) + { + selector_ = &n; + } + + void + set_right_node (UnionMember& n) + { + member_ = &n; + } + + private: + Selector* selector_; + UnionMember* member_; + }; + + class UnionMember : public virtual Member + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + UnionMember (Path const& path, unsigned long line) + : Node (path, line), Member (path, line) + { + type_info (static_type_info ()); + } + }; + + class Selector : public virtual Node + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Selector () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~Selector () = 0; + }; + + class DefaultSelector : public virtual Selector + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + DefaultSelector (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + class ValueSelector : public virtual Selector, + public virtual Instance + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ValueSelector (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + class Union : public virtual Specialization, + public virtual Scope + { + public: + virtual bool + complete () const; + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Union (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + + using Specialization::add_edge_left; + using Specialization::add_edge_right; + using Scope::add_edge_left; + using Scope::add_edge_right; + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_UNION_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.cpp new file mode 100644 index 00000000000..1d151613dcc --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.cpp @@ -0,0 +1,102 @@ +// file : CCF/IDL2/SemanticGraph/ValueType.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/ValueType.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // ValueType + // + // + namespace + { + TypeInfo + value_type_init_ () + { + TypeInfo ti (typeid (ValueType)); + ti.add_base (Access::PUBLIC, true, Type::static_type_info ()); + ti.add_base (Access::PUBLIC, true, Scope::static_type_info ()); + return ti; + } + + TypeInfo value_type_ (value_type_init_ ()); + } + + TypeInfo const& ValueType:: + static_type_info () { return value_type_; } + + ValueType:: + ~ValueType () + { + } + + // AbstractValueType + // + // + namespace + { + TypeInfo + abstract_value_type_init_ () + { + TypeInfo ti (typeid (AbstractValueType)); + ti.add_base (Access::PUBLIC, true, ValueType::static_type_info ()); + return ti; + } + + TypeInfo abstract_value_type_ (abstract_value_type_init_ ()); + } + + TypeInfo const& AbstractValueType:: + static_type_info () { return abstract_value_type_; } + + + // ConcreteValueType + // + // + namespace + { + TypeInfo + concrete_value_type_init_ () + { + TypeInfo ti (typeid (ConcreteValueType)); + ti.add_base (Access::PUBLIC, true, ValueType::static_type_info ()); + return ti; + } + + TypeInfo concrete_value_type_ (concrete_value_type_init_ ()); + } + + TypeInfo const& ConcreteValueType:: + static_type_info () { return concrete_value_type_; } + + + // ValueTypeFactory + // + // + namespace + { + TypeInfo + value_type_factory_init_ () + { + TypeInfo ti (typeid (ValueTypeFactory)); + ti.add_base ( + Access::PUBLIC, true, TwoWayOperation::static_type_info ()); + return ti; + } + + TypeInfo value_type_factory_ (value_type_factory_init_ ()); + } + + TypeInfo const& ValueTypeFactory:: + static_type_info () { return value_type_factory_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.hpp new file mode 100644 index 00000000000..f918ee17dc6 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.hpp @@ -0,0 +1,174 @@ +// file : CCF/IDL2/SemanticGraph/ValueType.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/Operation.hpp" +#include "CCF/IDL2/SemanticGraph/Interface.hpp" // Supports + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + // + // + // + class ValueType : public virtual Type, + public virtual Scope + { + typedef + std::vector <Inherits*> + Inherits_; + + typedef + std::vector <Supports*> + Supports_; + + public: + typedef + Inherits_::const_iterator + InheritsIterator; + + InheritsIterator + inherits_begin () const + { + return inherits_.begin (); + } + + InheritsIterator + inherits_end () const + { + return inherits_.end (); + } + + typedef + Supports_::const_iterator + SupportsIterator; + + SupportsIterator + supports_begin () const + { + return supports_.begin (); + } + + SupportsIterator + supports_end () const + { + return supports_.end (); + } + + public: + virtual bool + complete () const + { + return true; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ValueType () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~ValueType () = 0; + + using Type::add_edge_right; + using Scope::add_edge_left; + + void + add_edge_left (Inherits& e) + { + inherits_.push_back (&e); + } + + void + add_edge_right (Inherits&) + { + } + + void + add_edge_left (Supports& e) + { + supports_.push_back (&e); + } + + private: + Inherits_ inherits_; + Supports_ supports_; + }; + + + // + // + // + class AbstractValueType : public virtual ValueType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + AbstractValueType (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class ConcreteValueType : public virtual ValueType + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ConcreteValueType (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class ValueTypeFactory : public virtual TwoWayOperation + { + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ValueTypeFactory (Path const& path, unsigned long line) + : Node (path, line), TwoWayOperation (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_HPP diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.cpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.cpp new file mode 100644 index 00000000000..0afeabd5fd0 --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.cpp @@ -0,0 +1,90 @@ +// file : CCF/IDL2/SemanticGraph/ValueTypeMember.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/ValueTypeMember.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + + // ValueTypeMember + // + // + namespace + { + TypeInfo + value_type_member_init_ () + { + TypeInfo ti (typeid (ValueTypeMember)); + ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ()); + ti.add_base (Access::PUBLIC, true, Instance::static_type_info ()); + return ti; + } + + TypeInfo + value_type_member_ (value_type_member_init_ ()); + } + + TypeInfo const& ValueTypeMember:: + static_type_info () { return value_type_member_; } + + ValueTypeMember:: + ~ValueTypeMember () + { + } + + + // ValueTypePrivateMember + // + // + namespace + { + TypeInfo + value_type_private_member_init_ () + { + TypeInfo ti (typeid (ValueTypePrivateMember)); + ti.add_base (Access::PUBLIC, + true, + ValueTypeMember::static_type_info ()); + return ti; + } + + TypeInfo + value_type_private_member_ (value_type_private_member_init_ ()); + } + + TypeInfo const& ValueTypePrivateMember:: + static_type_info () { return value_type_private_member_; } + + + // ValueTypePublicMember + // + // + namespace + { + TypeInfo + value_type_public_member_init_ () + { + TypeInfo ti (typeid (ValueTypePublicMember)); + ti.add_base (Access::PUBLIC, + true, + ValueTypeMember::static_type_info ()); + return ti; + } + + TypeInfo + value_type_public_member_ (value_type_public_member_init_ ()); + } + + TypeInfo const& ValueTypePublicMember:: + static_type_info () { return value_type_public_member_; } + } + } +} diff --git a/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.hpp b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.hpp new file mode 100644 index 00000000000..47649de0c6a --- /dev/null +++ b/modules/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.hpp @@ -0,0 +1,107 @@ +// file : CCF/IDL2/SemanticGraph/ValueTypeMember.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_MEMBER_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_MEMBER_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + + // + // + // + class ValueTypeMember : public virtual Nameable, + public virtual Instance + { + public: + struct Access + { + enum Value + { + public_, + private_ + }; + }; + + virtual Access::Value + access () const = 0; + + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + ValueTypeMember () // For virtual inheritance only. + { + type_info (static_type_info ()); + } + + virtual + ~ValueTypeMember () = 0; + }; + + + // + // + // + class ValueTypePrivateMember : public virtual ValueTypeMember + { + public: + virtual Access::Value + access () const + { + return Access::private_; + } + + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ValueTypePrivateMember (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + + + // + // + // + class ValueTypePublicMember : public virtual ValueTypeMember + { + public: + virtual Access::Value + access () const + { + return Access::public_; + } + + public: + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + ValueTypePublicMember (Path const& path, unsigned long line) + : Node (path, line) + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_MEMBER_HPP |