diff options
author | Abdullah Sowayan <sowayan@users.noreply.github.com> | 2007-03-18 22:23:37 +0000 |
---|---|---|
committer | Abdullah Sowayan <sowayan@users.noreply.github.com> | 2007-03-18 22:23:37 +0000 |
commit | 06a34455bd98b1379cc69bbc5b2cf085e0fc0d9b (patch) | |
tree | 8815ce3b3a85c3c4285429295f338e00ea4497f4 /CIAO/CCF/CCF/IDL2/Traversal | |
parent | d66fcc9b4aaec8e88eeb83fc578fdf8a3cc963de (diff) | |
download | ATCD-Static_RT_DAnCE.tar.gz |
Diffstat (limited to 'CIAO/CCF/CCF/IDL2/Traversal')
43 files changed, 4095 insertions, 0 deletions
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Array.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Array.cpp new file mode 100644 index 00000000000..e142383535f --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Array.cpp @@ -0,0 +1,78 @@ +// file : CCF/IDL2/Traversal/Array.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Array.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + void Array:: + traverse (Type& a) + { + pre (a); + arguments_with_type (a); + arguments_with_value (a); + name (a); + post (a); + } + + void Array:: + pre (Type&) + { + } + + void Array:: + arguments_with_type (Type& a, EdgeDispatcherBase& d) + { + d.traverse (**a.arguments_begin ()); + } + + void Array:: + arguments_with_type (Type& a) + { + arguments_with_type (a, edge_traverser ()); + } + + void Array:: + arguments_with_value (Type& a, EdgeDispatcherBase& d) + { + Type::ArgumentsIterator + b (a.arguments_begin ()), e (a.arguments_end ()); + + ++b; // Bounds start afterthe type. + + iterate_and_traverse (b, + e, + d, + *this, + &Array::comma, + a); + } + + void Array:: + arguments_with_value (Type& a) + { + arguments_with_value (a, edge_traverser ()); + } + + void Array:: + comma (Type&) + { + } + + void Array:: + name (Type&) + { + } + + void Array:: + post (Type&) + { + } + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Array.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Array.hpp new file mode 100644 index 00000000000..fb608c6df9a --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Array.hpp @@ -0,0 +1,51 @@ +// file : CCF/IDL2/Traversal/Array.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_ARRAY_HPP +#define CCF_IDL2_TRAVERSAL_ARRAY_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" + +#include "CCF/IDL2/SemanticGraph/Array.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + struct Array : Node<SemanticGraph::Array> + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + arguments_with_type (Type&, EdgeDispatcherBase&); + + virtual void + arguments_with_type (Type&); + + virtual void + arguments_with_value (Type&, EdgeDispatcherBase&); + + virtual void + arguments_with_value (Type&); + + virtual void + comma (Type&); + + virtual void + name (Type&); + + virtual void + post (Type&); + }; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_ARRAY_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Attribute.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Attribute.cpp new file mode 100644 index 00000000000..42ff8bd21bf --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Attribute.cpp @@ -0,0 +1,280 @@ +// file : CCF/IDL2/Traversal/Attribute.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Attribute.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // Attribute + // + // + void Attribute:: + traverse (Type& a) + { + pre (a); + belongs (a); + name (a); + post (a); + } + + void Attribute:: + pre (Type&) + { + } + + void Attribute:: + belongs (Type& a, EdgeDispatcherBase& d) + { + d.traverse (a.belongs ()); + } + + void Attribute:: + belongs (Type& a) + { + belongs (a, edge_traverser ()); + } + + void Attribute:: + name (Type&) + { + } + + void Attribute:: + post (Type&) + { + } + + // ReadAttribute + // + // + void ReadAttribute:: + traverse (Type& a) + { + pre (a); + belongs (a); + name (a); + get_raises (a); + post (a); + } + + void ReadAttribute:: + pre (Type&) + { + } + + void ReadAttribute:: + belongs (Type& a, EdgeDispatcherBase& d) + { + d.traverse (a.belongs ()); + } + + void ReadAttribute:: + belongs (Type& a) + { + belongs (a, edge_traverser ()); + } + + void ReadAttribute:: + name (Type&) + { + } + + void ReadAttribute:: + get_raises (Type& a, EdgeDispatcherBase& d) + { + iterate_and_traverse (a.get_raises_begin (), a.get_raises_end (), d); + } + + void ReadAttribute:: + get_raises (Type& a) + { + Type::GetRaisesIterator + b (a.get_raises_begin ()), + e (a.get_raises_end ()); + + if (b != e) + { + get_raises_pre (a); + iterate_and_traverse (b, + e, + edge_traverser (), + *this, + &ReadAttribute::comma, + a); + get_raises_post (a); + } + else + { + get_raises_none (a); + } + } + + void ReadAttribute:: + get_raises_pre (Type&) + { + } + + void ReadAttribute:: + get_raises_post (Type&) + { + } + + void ReadAttribute:: + get_raises_none (Type&) + { + } + + void ReadAttribute:: + post (Type&) + { + } + + void ReadAttribute:: + comma (Type&) + { + } + + + // ReadWriteAttribute + // + // + void ReadWriteAttribute:: + traverse (Type& a) + { + pre (a); + belongs (a); + name (a); + get_raises (a); + set_raises (a); + post (a); + } + + void ReadWriteAttribute:: + pre (Type&) + { + } + + void ReadWriteAttribute:: + belongs (Type& a, EdgeDispatcherBase& d) + { + d.traverse (a.belongs ()); + } + + void ReadWriteAttribute:: + belongs (Type& a) + { + belongs (a, edge_traverser ()); + } + + void ReadWriteAttribute:: + name (Type&) + { + } + + void ReadWriteAttribute:: + get_raises (Type& a, EdgeDispatcherBase& d) + { + iterate_and_traverse (a.get_raises_begin (), a.get_raises_end (), d); + } + + void ReadWriteAttribute:: + get_raises (Type& a) + { + Type::GetRaisesIterator + b (a.get_raises_begin ()), + e (a.get_raises_end ()); + + if (b != e) + { + get_raises_pre (a); + iterate_and_traverse (b, + e, + edge_traverser (), + *this, + &ReadWriteAttribute::comma, + a); + get_raises_post (a); + } + else + { + get_raises_none (a); + } + } + + void ReadWriteAttribute:: + get_raises_pre (Type&) + { + } + + void ReadWriteAttribute:: + get_raises_post (Type&) + { + } + + void ReadWriteAttribute:: + get_raises_none (Type&) + { + } + + void ReadWriteAttribute:: + set_raises (Type& a, EdgeDispatcherBase& d) + { + iterate_and_traverse (a.set_raises_begin (), a.set_raises_end (), d); + } + + void ReadWriteAttribute:: + set_raises (Type& a) + { + Type::SetRaisesIterator + b (a.set_raises_begin ()), + e (a.set_raises_end ()); + + if (b != e) + { + set_raises_pre (a); + iterate_and_traverse (b, + e, + edge_traverser (), + *this, + &ReadWriteAttribute::comma, + a); + set_raises_post (a); + } + else + { + set_raises_none (a); + } + } + + void ReadWriteAttribute:: + set_raises_pre (Type&) + { + } + + void ReadWriteAttribute:: + set_raises_post (Type&) + { + } + + void ReadWriteAttribute:: + set_raises_none (Type&) + { + } + + void ReadWriteAttribute:: + post (Type&) + { + } + + void ReadWriteAttribute:: + comma (Type&) + { + } + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Attribute.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Attribute.hpp new file mode 100644 index 00000000000..522671b6609 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Attribute.hpp @@ -0,0 +1,170 @@ +// file : CCF/IDL2/Traversal/Attribute.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_ATTRIBUTE_HPP +#define CCF_IDL2_TRAVERSAL_ATTRIBUTE_HPP + +#include "CCF/IDL2/SemanticGraph/Attribute.hpp" +#include "CCF/IDL2/Traversal/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // + // + // + struct GetRaises : Edge<SemanticGraph::GetRaises> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.exception ()); + } + }; + + + // + // + // + struct SetRaises : Edge<SemanticGraph::SetRaises> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.exception ()); + } + }; + + + // + // + // + struct Attribute : Node<SemanticGraph::Attribute> + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + belongs (Type&, EdgeDispatcherBase&); + + virtual void + belongs (Type&); + + virtual void + name (Type&); + + virtual void + post (Type&); + }; + + // + // + // + struct ReadAttribute : Node<SemanticGraph::ReadAttribute> + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + belongs (Type&, EdgeDispatcherBase&); + + virtual void + belongs (Type&); + + virtual void + name (Type&); + + virtual void + get_raises (Type&, EdgeDispatcherBase&); + + virtual void + get_raises (Type&); + + virtual void + get_raises_pre (Type&); + + virtual void + get_raises_post (Type&); + + virtual void + get_raises_none (Type&); + + virtual void + post (Type&); + + virtual void + comma (Type&); + }; + + + // + // + // + struct ReadWriteAttribute : Node<SemanticGraph::ReadWriteAttribute> + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + belongs (Type&, EdgeDispatcherBase&); + + virtual void + belongs (Type&); + + virtual void + name (Type&); + + virtual void + get_raises (Type&, EdgeDispatcherBase&); + + virtual void + get_raises (Type&); + + virtual void + get_raises_pre (Type&); + + virtual void + get_raises_post (Type&); + + virtual void + get_raises_none (Type&); + + virtual void + set_raises (Type&, EdgeDispatcherBase&); + + virtual void + set_raises (Type&); + + virtual void + set_raises_pre (Type&); + + virtual void + set_raises_post (Type&); + + virtual void + set_raises_none (Type&); + + virtual void + post (Type&); + + virtual void + comma (Type&); + }; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_ATTRIBUTE_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Elements.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Elements.cpp new file mode 100644 index 00000000000..c7a24089a42 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Elements.cpp @@ -0,0 +1,16 @@ +// file : CCF/IDL2/Traversal/Elements.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Elements.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Elements.hpp new file mode 100644 index 00000000000..03793aafeef --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Elements.hpp @@ -0,0 +1,471 @@ +// file : CCF/IDL2/Traversal/Elements.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_ELEMENTS_HPP +#define CCF_IDL2_TRAVERSAL_ELEMENTS_HPP + +#include <map> +#include <set> + +#include "CCF/CompilerElements/Introspection.hpp" + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +/* +#include <iostream> + +using std::cerr; +using std::endl; +*/ + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // + // + // + template<typename T> + class Traverser + { + protected: + virtual + ~Traverser (); + + virtual void + trampoline (T& n) = 0; + + template <typename> + friend class Dispatcher; + }; + + + // + // + // + template <typename T> + class Dispatcher + { + public: + virtual + ~Dispatcher (); + + virtual void + traverse (T& n); + + void + map (Introspection::TypeId id, Traverser<T>& t) + { + Traversers& traversers (traversal_map_[id]); + traversers.push_back (&t); + } + + public: + typedef + std::vector<Traverser<T>*> + Traversers; + + typedef + std::map<Introspection::TypeId, Traversers> + TraversalMap; + + typedef + typename TraversalMap::const_iterator + Iterator; + + Iterator + begin () const + { + return traversal_map_.begin (); + } + + Iterator + end () const + { + return traversal_map_.end (); + } + + private: + struct TypeInfoComparator + { + bool + operator () (Introspection::TypeInfo const& x, + Introspection::TypeInfo const& y) const + { + return x.type_id () < y.type_id (); + } + }; + + typedef + std::map<Introspection::TypeInfo, unsigned long, TypeInfoComparator> + LevelMap; + + typedef + std::set<Introspection::TypeInfo, TypeInfoComparator> + TypeInfoSet; + + static unsigned long + compute_levels (Introspection::TypeInfo const& ti, + unsigned long cur, + LevelMap& map); + + static void + flatten_tree (Introspection::TypeInfo const& ti, TypeInfoSet& set); + + private: + TraversalMap traversal_map_; + }; + + + // + // + // + typedef + Dispatcher<SemanticGraph::Node> + NodeDispatcherBase; + + typedef + Dispatcher<SemanticGraph::Edge> + EdgeDispatcherBase; + + + // + // + // + class NodeDispatcher : public virtual NodeDispatcherBase + { + public: + void + edge_traverser (EdgeDispatcherBase& d) + { + //@@ this should be done in Dispatcher in merge() function? + // + for (EdgeDispatcherBase::Iterator i (d.begin ()), end (d.end ()); + i != end; ++i) + { + for (EdgeDispatcherBase::Traversers::const_iterator + t (i->second.begin ()), end (i->second.end ()); + t != end; ++t) + { + dispatcher_.map (i->first, **t); + } + } + } + + protected: + template <typename I> + void + iterate_and_traverse (I begin, I end, EdgeDispatcherBase& d) + { + for (; begin != end; ++begin) + { + d.traverse (**begin); + } + } + + template <typename I, typename X, typename A> + void + iterate_and_traverse (I begin, + I end, + EdgeDispatcherBase& d, + X& x, + void (X::*f)(A&), + A& a) + { + for (I i (begin); i != end;) + { + d.traverse (**i); + + if (++i != end) (x.*f) (a); + } + } + + EdgeDispatcherBase& + edge_traverser () + { + return dispatcher_; + } + + protected: + EdgeDispatcherBase dispatcher_; + }; + + + class EdgeDispatcher : public virtual EdgeDispatcherBase + { + public: + //@@ this should be done in Dispatcher in merge() function? + // + void + node_traverser (NodeDispatcherBase& d) + { + for (NodeDispatcherBase::Iterator i (d.begin ()), end (d.end ()); + i != end; ++i) + { + for (NodeDispatcherBase::Traversers::const_iterator + t (i->second.begin ()), end (i->second.end ()); + t != end; ++t) + { + dispatcher_.map (i->first, **t); + } + } + } + + protected: + NodeDispatcherBase& + node_traverser () + { + return dispatcher_; + } + + protected: + NodeDispatcherBase dispatcher_; + }; + + + // + // + // + template <typename T> + struct Node : Traverser<SemanticGraph::Node>, virtual NodeDispatcher + { + typedef + T + Type; + + Node () + { + map (typeid (Type), *this); + } + + virtual void + trampoline (SemanticGraph::Node& n) + { + //cerr << "trampoline for " << &n << " to type " + // << typeid (Type).name () << endl; + + traverse (dynamic_cast<Type&> (n)); + } + + virtual void + traverse (Type&) = 0; + }; + + + template <typename T> + struct Edge : Traverser <SemanticGraph::Edge>, virtual EdgeDispatcher + { + typedef + T + Type; + + Edge () + { + map (typeid (Type), *this); + } + + virtual void + trampoline (SemanticGraph::Edge& e) + { + traverse (dynamic_cast<Type&> (e)); + } + + + virtual void + traverse (Type& e) = 0; + }; + + // Edges + // + // + struct Names : Edge<SemanticGraph::Names> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.named ()); + } + }; + + + struct Defines : Edge<SemanticGraph::Defines> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.named ()); + } + }; + + + struct Mentions : Edge<SemanticGraph::Mentions> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.named ()); + } + }; + + + + struct Aliases : Edge<SemanticGraph::Aliases> + { + virtual void + traverse (Type& a) + { + pre (a); + type (a); + name (a); + post (a); + } + + virtual void + pre (Type&) + { + } + + virtual void + type (Type& e) + { + node_traverser ().traverse (e.named ()); + } + + virtual void + name (Type&) + { + } + + virtual void + post (Type&) + { + } + }; + + + struct Belongs : Edge<SemanticGraph::Belongs> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.type ()); + } + }; + + + struct Arguments : Edge<SemanticGraph::Arguments> + { + virtual void + traverse (Type& a) + { + node_traverser ().traverse (a.argument ()); + } + }; + + struct ArgumentsWithType : Edge<SemanticGraph::ArgumentsWithType> + { + virtual void + traverse (Type& a) + { + node_traverser ().traverse (a.type ()); + } + }; + + struct ArgumentsWithValue : Edge<SemanticGraph::ArgumentsWithValue> + { + virtual void + traverse (Type& a) + { + node_traverser ().traverse (a.value ()); + } + }; + + struct Inherits : Edge<SemanticGraph::Inherits> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.inheritee ()); + } + }; + + + struct Contains : Edge<SemanticGraph::Contains> + { + }; + + + // Nodes + // + // + struct Nameable : Node<SemanticGraph::Nameable> + { + }; + + + template <typename T> + struct ScopeTemplate : Node<T> + { + public: + /* GCC#13590/DR#39 + using Node<T>::edge_traverser; + */ + + virtual void + traverse (T& s) + { + names (s); + } + + virtual void + names (T& s) + { + names_pre (s); + names (s, this->edge_traverser ()); + names_post (s); + } + + virtual void + names (T& s, EdgeDispatcherBase& d) + { + iterate_and_traverse (s.names_begin (), s.names_end (), d); + } + + virtual void + names_pre (T&) + { + } + + virtual void + names_post (T&) + { + } + }; + + + // + // + // + typedef + ScopeTemplate<SemanticGraph::Scope> + Scope; + + + // + // + // + struct Type : Node<SemanticGraph::Type> + { + virtual void + traverse (SemanticGraph::Type&) = 0; + }; + } + } +} + +#include "CCF/IDL2/Traversal/Elements.tpp" + +#endif // CCF_IDL2_TRAVERSAL_ELEMENTS_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Elements.tpp b/CIAO/CCF/CCF/IDL2/Traversal/Elements.tpp new file mode 100644 index 00000000000..60cace27f69 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Elements.tpp @@ -0,0 +1,128 @@ +// file : CCF/IDL2/Traversal/Elements.tpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include <iostream> + +using std::cerr; +using std::endl; + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // Traverser + // + // + + template<typename T> + Traverser<T>:: + ~Traverser () + { + } + + // Dispatcher + // + // + + template <typename T> + Dispatcher<T>:: + ~Dispatcher () + { + } + + template <typename T> + void Dispatcher<T>:: + traverse (T& n) + { + LevelMap levels; + + unsigned long max = compute_levels (n.type_info (), 0, levels); + + + //cerr << "starting dispatch process for " + // << n.type_info ().type_id () << " with " + // << max << " levels" << endl; + + for (unsigned long l = 0; l < max + 1; ++l) + { + TypeInfoSet dispatched; + + for (typename LevelMap::const_iterator + i (levels.begin ()), e (levels.end ()); + i != e; ++i) + { + if (i->second == l) + { + typename TraversalMap::const_iterator v ( + traversal_map_.find (i->first.type_id ())); + + if (v != traversal_map_.end ()) + { + //cerr << "dispatching traversers for " + // << n.type_info ().type_id () << " as " + // << i->first.type_id () << endl; + + Traversers const& traversers (v->second); + for (typename Traversers::const_iterator + ti (traversers.begin ()), te (traversers.end ()); + ti != te; ++ti) + { + (*ti)->trampoline (n); + } + + flatten_tree (i->first, dispatched); + } + } + } + + // Remove traversed types from level map. + // + for (typename TypeInfoSet::const_iterator i = dispatched.begin (); + i != dispatched.end (); + ++i) + { + levels.erase (*i); + } + } + } + + template <typename T> + unsigned long Dispatcher<T>:: + compute_levels (Introspection::TypeInfo const& ti, + unsigned long cur, + LevelMap& map) + { + unsigned long ret = cur; + + if (map.find (ti) == map.end () || map[ti] < cur) map[ti] = cur; + + for (Introspection::TypeInfo::BaseIterator i = ti.begin_base (); + i != ti.end_base (); + i++) + { + unsigned long t = compute_levels (i->type_info (), cur + 1, map); + if (t > ret) ret = t; + } + + return ret; + } + + template <typename T> + void Dispatcher<T>:: + flatten_tree (Introspection::TypeInfo const& ti, TypeInfoSet& set) + { + set.insert (ti); + + for (Introspection::TypeInfo::BaseIterator i = ti.begin_base (); + i != ti.end_base (); + i++) + { + flatten_tree (i->type_info (), set); + } + } + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Enum.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Enum.cpp new file mode 100644 index 00000000000..35df538f85b --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Enum.cpp @@ -0,0 +1,16 @@ +// file : CCF/IDL2/Traversal/Enum.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Enum.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + } + } +} + diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Enum.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Enum.hpp new file mode 100644 index 00000000000..d789f30b1b0 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Enum.hpp @@ -0,0 +1,30 @@ +// file : CCF/IDL2/Traversal/Enum.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_ENUM_HPP +#define CCF_IDL2_TRAVERSAL_ENUM_HPP + +#include "CCF/IDL2/SemanticGraph/Enum.hpp" +#include "CCF/IDL2/Traversal/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // Minimal support for now. Talk to me if you need more. + // + struct Enum : Node<SemanticGraph::Enum> + { + }; + + struct Enumerator : Node<SemanticGraph::Enumerator> + { + }; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_ENUM_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Exception.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Exception.cpp new file mode 100644 index 00000000000..21e41784c71 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Exception.cpp @@ -0,0 +1,38 @@ +// file : CCF/IDL2/Traversal/Exception.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Exception.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + void Exception:: + traverse (Type& s) + { + pre (s); + name (s); + names (s); + post (s); + } + + void Exception:: + pre (Type&) + { + } + + void Exception:: + name (Type&) + { + } + + void Exception:: + post (Type&) + { + } + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Exception.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Exception.hpp new file mode 100644 index 00000000000..23eda73f1a7 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Exception.hpp @@ -0,0 +1,36 @@ +// file : CCF/IDL2/Traversal/Exception.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_EXCEPTION_HPP +#define CCF_IDL2_TRAVERSAL_EXCEPTION_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" + +#include "CCF/IDL2/SemanticGraph/Exception.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + struct Exception : ScopeTemplate<SemanticGraph::Exception> + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + name (Type&); + + virtual void + post (Type&); + }; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_EXCEPTION_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.cpp new file mode 100644 index 00000000000..4dd6760cebe --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.cpp @@ -0,0 +1,16 @@ +// file : CCF/IDL2/Traversal/Fundamental.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Fundamental.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + } + } +} + diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.hpp new file mode 100644 index 00000000000..c4e10d18057 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.hpp @@ -0,0 +1,101 @@ +// file : CCF/IDL2/Traversal/Fundamental.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_FUNDAMENTAL_HPP +#define CCF_IDL2_TRAVERSAL_FUNDAMENTAL_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" + +#include "CCF/IDL2/SemanticGraph/Fundamental.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + typedef + Node<SemanticGraph::FundamentalType> + FundamentalType; + + typedef + Node<SemanticGraph::Object> + Object; + + typedef + Node<SemanticGraph::ValueBase> + ValueBase; + + typedef + Node<SemanticGraph::Any> + Any; + + typedef + Node<SemanticGraph::Boolean> + Boolean; + + typedef + Node<SemanticGraph::Char> + Char; + + typedef + Node<SemanticGraph::Double> + Double; + + typedef + Node<SemanticGraph::Float> + Float; + + typedef + Node<SemanticGraph::Long> + Long; + + typedef + Node<SemanticGraph::LongDouble> + LongDouble; + + typedef + Node<SemanticGraph::LongLong> + LongLong; + + typedef + Node<SemanticGraph::Octet> + Octet; + + typedef + Node<SemanticGraph::Short> + Short; + + typedef + Node<SemanticGraph::String> + String; + + typedef + Node<SemanticGraph::UnsignedLong> + UnsignedLong; + + typedef + Node<SemanticGraph::UnsignedLongLong> + UnsignedLongLong; + + typedef + Node<SemanticGraph::UnsignedShort> + UnsignedShort; + + typedef + Node<SemanticGraph::Void> + Void; + + typedef + Node<SemanticGraph::Wchar> + Wchar; + + typedef + Node<SemanticGraph::Wstring> + Wstring; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_FUNDAMENTAL_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/IntExpression.hpp b/CIAO/CCF/CCF/IDL2/Traversal/IntExpression.hpp new file mode 100644 index 00000000000..8e111874251 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/IntExpression.hpp @@ -0,0 +1,757 @@ +// file : CCF/IDL2/Traversal/IntExpression.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_INT_EXPRESSION_HPP +#define CCF_IDL2_TRAVERSAL_INT_EXPRESSION_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" + +#include "CCF/IDL2/SemanticGraph/IntExpression.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // + // + typedef + Node<SemanticGraph::IntExpression> + IntExpression; + + // + // + typedef + Node<SemanticGraph::IntLiteral> + IntLiteral; + + // + // + typedef + Node<SemanticGraph::IntConst> + IntConst; + + + // NEG + // + + struct IntNegates: Edge<SemanticGraph::IntNegates> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.argument ()); + } + }; + + struct IntNeg: Node<SemanticGraph::IntNeg> + { + virtual void + traverse (Type& n) + { + pre (n); + negates (n); + post (n); + } + + virtual void + pre (Type&) + { + } + + virtual void + negates (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n.negates ()); + } + + virtual void + negates (Type& n) + { + negates (n, edge_traverser ()); + } + + virtual void + post (Type&) + { + } + }; + + + // COM + // + + struct IntComplements: Edge<SemanticGraph::IntComplements> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.argument ()); + } + }; + + struct IntCom: Node<SemanticGraph::IntCom> + { + virtual void + traverse (Type& n) + { + pre (n); + complements (n); + post (n); + } + + virtual void + pre (Type&) + { + } + + virtual void + complements (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n.complements ()); + } + + virtual void + complements (Type& n) + { + complements (n, edge_traverser ()); + } + + virtual void + post (Type&) + { + } + }; + + + // MUL + // + + struct IntMultiplies: Edge<SemanticGraph::IntMultiplies> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.argument ()); + } + }; + + struct IntMul: Node<SemanticGraph::IntMul> + { + virtual void + traverse (Type& n) + { + pre (n); + multiplies_first_factor (n); + sign (n); + multiplies_second_factor (n); + post (n); + } + + virtual void + pre (Type&) + { + } + + virtual void + multiplies_first_factor (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n.first_factor ()); + } + + virtual void + multiplies_first_factor (Type& n) + { + multiplies_first_factor (n, edge_traverser ()); + } + + virtual void + sign (Type&) + { + } + + virtual void + multiplies_second_factor (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n. second_factor ()); + } + + virtual void + multiplies_second_factor (Type& n) + { + multiplies_second_factor (n, edge_traverser ()); + } + + virtual void + post (Type&) + { + } + }; + + + // DIV & REM + // + + struct IntDivides: Edge<SemanticGraph::IntDivides> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.argument ()); + } + }; + + struct IntDiv: Node<SemanticGraph::IntDiv> + { + virtual void + traverse (Type& n) + { + pre (n); + divides_divident (n); + sign (n); + divides_divisor (n); + post (n); + } + + virtual void + pre (Type&) + { + } + + virtual void + divides_divident (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n.divident ()); + } + + virtual void + divides_divident (Type& n) + { + divides_divident (n, edge_traverser ()); + } + + virtual void + sign (Type&) + { + } + + virtual void + divides_divisor (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n. divisor ()); + } + + virtual void + divides_divisor (Type& n) + { + divides_divisor (n, edge_traverser ()); + } + + virtual void + post (Type&) + { + } + }; + + struct IntRem: Node<SemanticGraph::IntRem> + { + virtual void + traverse (Type& n) + { + pre (n); + divides_divident (n); + sign (n); + divides_divisor (n); + post (n); + } + + virtual void + pre (Type&) + { + } + + virtual void + divides_divident (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n.divident ()); + } + + virtual void + divides_divident (Type& n) + { + divides_divident (n, edge_traverser ()); + } + + virtual void + sign (Type&) + { + } + + virtual void + divides_divisor (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n. divisor ()); + } + + virtual void + divides_divisor (Type& n) + { + divides_divisor (n, edge_traverser ()); + } + + virtual void + post (Type&) + { + } + }; + + + // ADD + // + + struct IntAdds: Edge<SemanticGraph::IntAdds> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.argument ()); + } + }; + + struct IntAdd: Node<SemanticGraph::IntAdd> + { + virtual void + traverse (Type& n) + { + pre (n); + adds_first_item (n); + sign (n); + adds_second_item (n); + post (n); + } + + virtual void + pre (Type&) + { + } + + virtual void + adds_first_item (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n.first_item ()); + } + + virtual void + adds_first_item (Type& n) + { + adds_first_item (n, edge_traverser ()); + } + + virtual void + sign (Type&) + { + } + + virtual void + adds_second_item (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n. second_item ()); + } + + virtual void + adds_second_item (Type& n) + { + adds_second_item (n, edge_traverser ()); + } + + virtual void + post (Type&) + { + } + }; + + + // SUB + // + + struct IntSubtracts: Edge<SemanticGraph::IntSubtracts> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.argument ()); + } + }; + + struct IntSub: Node<SemanticGraph::IntSub> + { + virtual void + traverse (Type& n) + { + pre (n); + subtracts_minuend (n); + sign (n); + subtracts_subtrahend (n); + post (n); + } + + virtual void + pre (Type&) + { + } + + virtual void + subtracts_minuend (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n.minuend ()); + } + + virtual void + subtracts_minuend (Type& n) + { + subtracts_minuend (n, edge_traverser ()); + } + + virtual void + sign (Type&) + { + } + + virtual void + subtracts_subtrahend (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n. subtrahend ()); + } + + virtual void + subtracts_subtrahend (Type& n) + { + subtracts_subtrahend (n, edge_traverser ()); + } + + virtual void + post (Type&) + { + } + }; + + + // RSH & LSH + // + + struct IntShifts: Edge<SemanticGraph::IntShifts> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.argument ()); + } + }; + + struct IntRsh: Node<SemanticGraph::IntRsh> + { + virtual void + traverse (Type& n) + { + pre (n); + shifts_pattern (n); + sign (n); + shifts_factor (n); + post (n); + } + + virtual void + pre (Type&) + { + } + + virtual void + shifts_pattern (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n.pattern ()); + } + + virtual void + shifts_pattern (Type& n) + { + shifts_pattern (n, edge_traverser ()); + } + + virtual void + sign (Type&) + { + } + + virtual void + shifts_factor (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n. factor ()); + } + + virtual void + shifts_factor (Type& n) + { + shifts_factor (n, edge_traverser ()); + } + + virtual void + post (Type&) + { + } + }; + + struct IntLsh: Node<SemanticGraph::IntLsh> + { + virtual void + traverse (Type& n) + { + pre (n); + shifts_pattern (n); + sign (n); + shifts_factor (n); + post (n); + } + + virtual void + pre (Type&) + { + } + + virtual void + shifts_pattern (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n.pattern ()); + } + + virtual void + shifts_pattern (Type& n) + { + shifts_pattern (n, edge_traverser ()); + } + + virtual void + sign (Type&) + { + } + + virtual void + shifts_factor (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n. factor ()); + } + + virtual void + shifts_factor (Type& n) + { + shifts_factor (n, edge_traverser ()); + } + + virtual void + post (Type&) + { + } + }; + + + // AND + // + + struct IntConjuncts: Edge<SemanticGraph::IntConjuncts> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.argument ()); + } + }; + + struct IntAnd: Node<SemanticGraph::IntAnd> + { + virtual void + traverse (Type& n) + { + pre (n); + conjuncts_first_pattern (n); + sign (n); + conjuncts_second_pattern (n); + post (n); + } + + virtual void + pre (Type&) + { + } + + virtual void + conjuncts_first_pattern (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n.first_pattern ()); + } + + virtual void + conjuncts_first_pattern (Type& n) + { + conjuncts_first_pattern (n, edge_traverser ()); + } + + virtual void + sign (Type&) + { + } + + virtual void + conjuncts_second_pattern (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n. second_pattern ()); + } + + virtual void + conjuncts_second_pattern (Type& n) + { + conjuncts_second_pattern (n, edge_traverser ()); + } + + virtual void + post (Type&) + { + } + }; + + + // Xor + // + + struct IntExclusivelyDisjuncts: + Edge<SemanticGraph::IntExclusivelyDisjuncts> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.argument ()); + } + }; + + struct IntXor: Node<SemanticGraph::IntXor> + { + virtual void + traverse (Type& n) + { + pre (n); + exclusively_disjuncts_first_pattern (n); + sign (n); + exclusively_disjuncts_second_pattern (n); + post (n); + } + + virtual void + pre (Type&) + { + } + + virtual void + exclusively_disjuncts_first_pattern (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n.first_pattern ()); + } + + virtual void + exclusively_disjuncts_first_pattern (Type& n) + { + exclusively_disjuncts_first_pattern (n, edge_traverser ()); + } + + virtual void + sign (Type&) + { + } + + virtual void + exclusively_disjuncts_second_pattern (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n. second_pattern ()); + } + + virtual void + exclusively_disjuncts_second_pattern (Type& n) + { + exclusively_disjuncts_second_pattern (n, edge_traverser ()); + } + + virtual void + post (Type&) + { + } + }; + + + // Or + // + + struct IntInclusivelyDisjuncts: + Edge<SemanticGraph::IntInclusivelyDisjuncts> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.argument ()); + } + }; + + struct IntOr: Node<SemanticGraph::IntOr> + { + virtual void + traverse (Type& n) + { + pre (n); + inclusively_disjuncts_first_pattern (n); + sign (n); + inclusively_disjuncts_second_pattern (n); + post (n); + } + + virtual void + pre (Type&) + { + } + + virtual void + inclusively_disjuncts_first_pattern (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n.first_pattern ()); + } + + virtual void + inclusively_disjuncts_first_pattern (Type& n) + { + inclusively_disjuncts_first_pattern (n, edge_traverser ()); + } + + virtual void + sign (Type&) + { + } + + virtual void + inclusively_disjuncts_second_pattern (Type& n, EdgeDispatcherBase& d) + { + d.traverse (n. second_pattern ()); + } + + virtual void + inclusively_disjuncts_second_pattern (Type& n) + { + inclusively_disjuncts_second_pattern (n, edge_traverser ()); + } + + virtual void + post (Type&) + { + } + }; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_INT_EXPRESSION_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Interface.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Interface.cpp new file mode 100644 index 00000000000..fb6cbf9686c --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Interface.cpp @@ -0,0 +1,15 @@ +// file : CCF/IDL2/Traversal/Interface.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Interface.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Interface.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Interface.hpp new file mode 100644 index 00000000000..b0c05f36b80 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Interface.hpp @@ -0,0 +1,89 @@ +// file : CCF/IDL2/Traversal/Interface.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_INTERFACE_HPP +#define CCF_IDL2_TRAVERSAL_INTERFACE_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" + +#include "CCF/IDL2/SemanticGraph/Interface.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + struct Supports : Edge<SemanticGraph::Supports> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.supportee ()); + } + }; + + + template <typename T> + struct InterfaceTemplate : ScopeTemplate<T> + { + /* GCC#13590/DR#39 + using ScopeTemplate<T>::edge_traverser; + */ + + virtual void + traverse (T&); + + virtual void + pre (T&); + + virtual void + name (T&); + + virtual void + inherits (T&, EdgeDispatcherBase& d); + + virtual void + inherits (T&); + + virtual void + inherits_pre (T&); + + virtual void + inherits_post (T&); + + virtual void + inherits_none (T&); + + virtual void + post (T&); + + virtual void + comma (T&); + }; + + + typedef + InterfaceTemplate<SemanticGraph::Interface> + Interface; + + + typedef + InterfaceTemplate<SemanticGraph::AbstractInterface> + AbstractInterface; + + typedef + InterfaceTemplate<SemanticGraph::LocalInterface> + LocalInterface; + + typedef + InterfaceTemplate<SemanticGraph::UnconstrainedInterface> + UnconstrainedInterface; + } + } +} + +#include "CCF/IDL2/Traversal/Interface.tpp" + +#endif // CCF_IDL2_TRAVERSAL_INTERFACE_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Interface.tpp b/CIAO/CCF/CCF/IDL2/Traversal/Interface.tpp new file mode 100644 index 00000000000..23d2bfd922d --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Interface.tpp @@ -0,0 +1,99 @@ +// file : CCF/IDL2/Traversal/Interface.tpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + template <typename T> + void InterfaceTemplate<T>:: + traverse (T& i) + { + pre (i); + name (i); + inherits (i); + names (i); + post (i); + } + + template <typename T> + void InterfaceTemplate<T>:: + pre (T&) + { + } + + template <typename T> + void InterfaceTemplate<T>:: + name (T&) + { + } + + template <typename T> + void InterfaceTemplate<T>:: + inherits (T& i, EdgeDispatcherBase& d) + { + iterate_and_traverse (i.inherits_begin (), + i.inherits_end (), + d); + } + + template <typename T> + void InterfaceTemplate<T>:: + inherits (T& i) + { + typename T::InheritsIterator + b (i.inherits_begin ()), e (i.inherits_end ()); + + if (b != e) + { + inherits_pre (i); + iterate_and_traverse (b, + e, + this->edge_traverser (), + *this, + &InterfaceTemplate::comma, + i); + inherits_post (i); + } + else + { + inherits_none (i); + } + + } + + template <typename T> + void InterfaceTemplate<T>:: + inherits_pre (T&) + { + } + + template <typename T> + void InterfaceTemplate<T>:: + inherits_post (T&) + { + } + + template <typename T> + void InterfaceTemplate<T>:: + inherits_none (T&) + { + } + + template <typename T> + void InterfaceTemplate<T>:: + post (T&) + { + } + + template <typename T> + void InterfaceTemplate<T>:: + comma (T&) + { + } + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Member.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Member.cpp new file mode 100644 index 00000000000..01299a0b00c --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Member.cpp @@ -0,0 +1,50 @@ +// file : CCF/IDL2/Traversal/Member.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Member.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + void Member:: + traverse (Type& m) + { + pre (m); + belongs (m); + name (m); + post (m); + } + + void Member:: + pre (Type&) + { + } + + void Member:: + belongs (Type& m, EdgeDispatcherBase& d) + { + d.traverse (m.belongs ()); + } + + void Member:: + belongs (Type& m) + { + belongs (m, edge_traverser ()); + } + + void Member:: + name (Type&) + { + } + + void Member:: + post (Type&) + { + } + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Member.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Member.hpp new file mode 100644 index 00000000000..a0f05e6f33f --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Member.hpp @@ -0,0 +1,42 @@ +// file : CCF/IDL2/Traversal/Member.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_MEMBER_HPP +#define CCF_IDL2_TRAVERSAL_MEMBER_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" + +#include "CCF/IDL2/SemanticGraph/Member.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + struct Member : Node<SemanticGraph::Member> + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + belongs (Type&, EdgeDispatcherBase&); + + virtual void + belongs (Type&); + + virtual void + name (Type&); + + virtual void + post (Type&); + }; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_MEMBER_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Module.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Module.cpp new file mode 100644 index 00000000000..62f5d70aa9c --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Module.cpp @@ -0,0 +1,15 @@ +// file : CCF/IDL2/Traversal/Module.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Module.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Module.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Module.hpp new file mode 100644 index 00000000000..994c40dd590 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Module.hpp @@ -0,0 +1,48 @@ +// file : CCF/IDL2/Traversal/Module.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_MODULE_HPP +#define CCF_IDL2_TRAVERSAL_MODULE_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" + +#include "CCF/IDL2/SemanticGraph/Module.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + struct Module : ScopeTemplate<SemanticGraph::Module> + { + virtual void + traverse (Type& m) + { + pre (m); + name (m); + names (m); + post (m); + } + + virtual void + pre (Type&) + { + } + + virtual void + name (Type&) + { + } + + virtual void + post (Type&) + { + } + }; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_MODULE_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Native.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Native.cpp new file mode 100644 index 00000000000..59a99bec8ad --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Native.cpp @@ -0,0 +1,16 @@ +// file : CCF/IDL2/Traversal/Native.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Native.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + } + } +} + diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Native.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Native.hpp new file mode 100644 index 00000000000..ad70473c234 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Native.hpp @@ -0,0 +1,24 @@ +// file : CCF/IDL2/Traversal/Native.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_NATIVE_HPP +#define CCF_IDL2_TRAVERSAL_NATIVE_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/Native.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + typedef + Node<SemanticGraph::Native> + Native; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_NATIVE_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Operation.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Operation.cpp new file mode 100644 index 00000000000..2fca9de465b --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Operation.cpp @@ -0,0 +1,15 @@ +// file : CCF/IDL2/Traversal/Operation.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Operation.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Operation.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Operation.hpp new file mode 100644 index 00000000000..04a426301f0 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Operation.hpp @@ -0,0 +1,178 @@ +// file : CCF/IDL2/Traversal/Operation.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_OPERATION_HPP +#define CCF_IDL2_TRAVERSAL_OPERATION_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/Operation.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // + // + // + struct Receives : Edge<SemanticGraph::Receives> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.parameter ()); + } + }; + + + // + // + // + struct Returns : Edge<SemanticGraph::Returns> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.type ()); + } + }; + + // + // + // + struct Raises : Edge<SemanticGraph::Raises> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.exception ()); + } + }; + + // + // + // + template<typename T> + struct ParameterTemplate : Node<T> + { + /* GCC#13590/DR#39 + using Node<T>::edge_traverser; + */ + + virtual void + traverse (T&); + + virtual void + pre (T&); + + virtual void + belongs (T&, EdgeDispatcherBase&); + + virtual void + belongs (T&); + + virtual void + name (T&); + + virtual void + post (T&); + }; + + typedef + ParameterTemplate<SemanticGraph::Parameter> + Parameter; + + typedef + ParameterTemplate<SemanticGraph::InParameter> + InParameter; + + typedef + ParameterTemplate<SemanticGraph::InOutParameter> + InOutParameter; + + typedef + ParameterTemplate<SemanticGraph::OutParameter> + OutParameter; + + // + // + // + template <typename T> + struct OperationTemplate : Node<T> + { + /* GCC#13590/DR#39 + using Node<T>::edge_traverser; + */ + + virtual void + traverse (T&); + + virtual void + pre (T&); + + virtual void + returns (T&, EdgeDispatcherBase&); + + virtual void + returns (T&); + + virtual void + name (T&); + + virtual void + receives (T&, EdgeDispatcherBase&); + + virtual void + receives (T&); + + virtual void + receives_pre (T&); + + virtual void + receives_post (T&); + + virtual void + receives_none (T&); + + virtual void + raises (T&, EdgeDispatcherBase&); + + virtual void + raises (T&); + + virtual void + raises_pre (T&); + + virtual void + raises_post (T&); + + virtual void + raises_none (T&); + + virtual void + post (T&); + + virtual void + comma (T&); + }; + + typedef + OperationTemplate<SemanticGraph::Operation> + Operation; + + typedef + OperationTemplate<SemanticGraph::OneWayOperation> + OneWayOperation; + + typedef + OperationTemplate<SemanticGraph::TwoWayOperation> + TwoWayOperation; + } + } +} + +#include "CCF/IDL2/Traversal/Operation.tpp" + +#endif // CCF_IDL2_TRAVERSAL_OPERATION_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Operation.tpp b/CIAO/CCF/CCF/IDL2/Traversal/Operation.tpp new file mode 100644 index 00000000000..bcb3760ec3b --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Operation.tpp @@ -0,0 +1,201 @@ +// file : CCF/IDL2/Traversal/Operation.tpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // ParameterTemplate + // + // + template<typename T> + void ParameterTemplate<T>:: + traverse (T& p) + { + pre (p); + belongs (p); + name (p); + post (p); + } + + template<typename T> + void ParameterTemplate<T>:: + pre (T&) + { + } + + template<typename T> + void ParameterTemplate<T>:: + belongs (T& p, EdgeDispatcherBase& d) + { + d.traverse (p.belongs ()); + } + + template<typename T> + void ParameterTemplate<T>:: + belongs (T& p) + { + belongs (p, this->edge_traverser ()); + } + + template<typename T> + void ParameterTemplate<T>:: + name (T&) + { + } + + template<typename T> + void ParameterTemplate<T>:: + post (T&) + { + } + + + // OperationTemplate + // + // + template<typename T> + void OperationTemplate<T>:: + traverse (T& o) + { + pre (o); + returns (o); + name (o); + receives (o); + raises (o); + post (o); + } + + template<typename T> + void OperationTemplate<T>:: + pre (T&) + { + } + + template<typename T> + void OperationTemplate<T>:: + returns (T& o, EdgeDispatcherBase& d) + { + d.traverse (o.returns ()); + } + + template<typename T> + void OperationTemplate<T>:: + returns (T& o) + { + returns (o, this->edge_traverser ()); + } + + template<typename T> + void OperationTemplate<T>:: + name (T&) + { + } + + template<typename T> + void OperationTemplate<T>:: + receives (T& o, EdgeDispatcherBase& d) + { + iterate_and_traverse (o.receives_begin (), o.receives_end (), d); + } + + template<typename T> + void OperationTemplate<T>:: + receives (T& o) + { + typename T::ReceivesIterator + b (o.receives_begin ()), e (o.receives_end ()); + + if (b != e) + { + receives_pre (o); + iterate_and_traverse ( + b, e, this->edge_traverser (), *this, &OperationTemplate<T>::comma, o); + receives_post (o); + } + else + { + receives_none (o); + } + } + + template<typename T> + void OperationTemplate<T>:: + receives_pre (T&) + { + } + + template<typename T> + void OperationTemplate<T>:: + receives_post (T&) + { + } + + template<typename T> + void OperationTemplate<T>:: + receives_none (T&) + { + } + + + template<typename T> + void OperationTemplate<T>:: + raises (T& o, EdgeDispatcherBase& d) + { + iterate_and_traverse (o.raises_begin (), o.raises_end (), d); + } + + template<typename T> + void OperationTemplate<T>:: + raises (T& o) + { + typename T::RaisesIterator b (o.raises_begin ()), e (o.raises_end ()); + + if (b != e) + { + raises_pre (o); + iterate_and_traverse ( + b, e, this->edge_traverser (), *this, &OperationTemplate<T>::comma, o); + raises_post (o); + } + else + { + raises_none (o); + } + } + + template<typename T> + void OperationTemplate<T>:: + raises_pre (T&) + { + } + + template<typename T> + void OperationTemplate<T>:: + raises_post (T&) + { + } + + template<typename T> + void OperationTemplate<T>:: + raises_none (T&) + { + } + + template<typename T> + void OperationTemplate<T>:: + post (T&) + { + } + + template<typename T> + void OperationTemplate<T>:: + comma (T&) + { + } + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Sequence.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Sequence.cpp new file mode 100644 index 00000000000..c781cdcfb97 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Sequence.cpp @@ -0,0 +1,111 @@ +// file : CCF/IDL2/Traversal/Sequence.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Sequence.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + + // UnboundedSequence + // + + void UnboundedSequence:: + traverse (Type& us) + { + pre (us); + arguments_with_type (us); + name (us); + post (us); + } + + void UnboundedSequence:: + pre (Type&) + { + } + + void UnboundedSequence:: + arguments_with_type (Type& us, EdgeDispatcherBase& d) + { + d.traverse (**us.arguments_begin ()); + } + + void UnboundedSequence:: + arguments_with_type (Type& us) + { + arguments_with_type (us, edge_traverser ()); + } + + void UnboundedSequence:: + name (Type&) + { + } + + void UnboundedSequence:: + post (Type&) + { + } + + + // BoundedSequence + // + + void BoundedSequence:: + traverse (Type& bs) + { + pre (bs); + arguments_with_type (bs); + arguments_with_value (bs); + name (bs); + post (bs); + } + + void BoundedSequence:: + pre (Type&) + { + } + + void BoundedSequence:: + arguments_with_type (Type& bs, EdgeDispatcherBase& d) + { + d.traverse (**bs.arguments_begin ()); + } + + void BoundedSequence:: + arguments_with_type (Type& bs) + { + arguments_with_type (bs, edge_traverser ()); + } + + void BoundedSequence:: + arguments_with_value (Type& bs, EdgeDispatcherBase& d) + { + Type::ArgumentsIterator i (bs.arguments_begin ()); + + ++i; // Bound is always second to the type. + + d.traverse (**i); + } + + void BoundedSequence:: + arguments_with_value (Type& bs) + { + arguments_with_value (bs, edge_traverser ()); + } + + void BoundedSequence:: + name (Type&) + { + } + + void BoundedSequence:: + post (Type&) + { + } + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Sequence.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Sequence.hpp new file mode 100644 index 00000000000..8011ff85c38 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Sequence.hpp @@ -0,0 +1,69 @@ +// file : CCF/IDL2/Traversal/Sequence.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_SEQUENCE_HPP +#define CCF_IDL2_TRAVERSAL_SEQUENCE_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" + +#include "CCF/IDL2/SemanticGraph/Sequence.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + struct UnboundedSequence : Node<SemanticGraph::UnboundedSequence> + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + arguments_with_type (Type&, EdgeDispatcherBase&); + + virtual void + arguments_with_type (Type&); + + virtual void + name (Type&); + + virtual void + post (Type&); + }; + + struct BoundedSequence : Node<SemanticGraph::BoundedSequence> + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + arguments_with_type (Type&, EdgeDispatcherBase&); + + virtual void + arguments_with_type (Type&); + + virtual void + arguments_with_value (Type&, EdgeDispatcherBase&); + + virtual void + arguments_with_value (Type&); + + virtual void + name (Type&); + + virtual void + post (Type&); + }; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_SEQUENCE_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/String.cpp b/CIAO/CCF/CCF/IDL2/Traversal/String.cpp new file mode 100644 index 00000000000..0d1e23883ed --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/String.cpp @@ -0,0 +1,93 @@ +// file : CCF/IDL2/Traversal/String.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/String.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // BoundedString + // + + void BoundedString:: + traverse (Type& s) + { + pre (s); + arguments_with_value (s); + name (s); + post (s); + } + + void BoundedString:: + pre (Type&) + { + } + + void BoundedString:: + arguments_with_value (Type& s, EdgeDispatcherBase& d) + { + d.traverse (**s.arguments_begin ()); + } + + void BoundedString:: + arguments_with_value (Type& s) + { + arguments_with_value (s, edge_traverser ()); + } + + void BoundedString:: + name (Type&) + { + } + + void BoundedString:: + post (Type&) + { + } + + + // BoundedWideString + // + + void BoundedWideString:: + traverse (Type& s) + { + pre (s); + arguments_with_value (s); + name (s); + post (s); + } + + void BoundedWideString:: + pre (Type&) + { + } + + void BoundedWideString:: + arguments_with_value (Type& s, EdgeDispatcherBase& d) + { + d.traverse (**s.arguments_begin ()); + } + + void BoundedWideString:: + arguments_with_value (Type& s) + { + arguments_with_value (s, edge_traverser ()); + } + + void BoundedWideString:: + name (Type&) + { + } + + void BoundedWideString:: + post (Type&) + { + } + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/String.hpp b/CIAO/CCF/CCF/IDL2/Traversal/String.hpp new file mode 100644 index 00000000000..7fca6eb7972 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/String.hpp @@ -0,0 +1,64 @@ +// file : CCF/IDL2/Traversal/String.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_STRING_HPP +#define CCF_IDL2_TRAVERSAL_STRING_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" + +#include "CCF/IDL2/SemanticGraph/String.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + struct BoundedString : Node<SemanticGraph::BoundedString> + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + arguments_with_value (Type&, EdgeDispatcherBase&); + + virtual void + arguments_with_value (Type&); + + virtual void + name (Type&); + + virtual void + post (Type&); + }; + + + struct BoundedWideString : Node<SemanticGraph::BoundedWideString> + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + arguments_with_value (Type&, EdgeDispatcherBase&); + + virtual void + arguments_with_value (Type&); + + virtual void + name (Type&); + + virtual void + post (Type&); + }; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_STRING_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Struct.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Struct.cpp new file mode 100644 index 00000000000..c9e4a23ee0d --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Struct.cpp @@ -0,0 +1,38 @@ +// file : CCF/IDL2/Traversal/Struct.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Struct.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + void Struct:: + traverse (Type& s) + { + pre (s); + name (s); + names (s); + post (s); + } + + void Struct:: + pre (Type&) + { + } + + void Struct:: + name (Type&) + { + } + + void Struct:: + post (Type&) + { + } + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Struct.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Struct.hpp new file mode 100644 index 00000000000..0ab61f8ef85 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Struct.hpp @@ -0,0 +1,35 @@ +// file : CCF/IDL2/Traversal/Struct.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_STRUCT_HPP +#define CCF_IDL2_TRAVERSAL_STRUCT_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/Struct.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + struct Struct : ScopeTemplate<SemanticGraph::Struct> + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + name (Type&); + + virtual void + post (Type&); + }; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_STRUCT_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Translation.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Translation.cpp new file mode 100644 index 00000000000..e3fcd58e272 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Translation.cpp @@ -0,0 +1,37 @@ +// file : CCF/IDL2/Traversal/Translation.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Translation.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // TranslationRegion + // + // + void TranslationRegion:: + traverse (SemanticGraph::TranslationRegion& r) + { + iterate_and_traverse (r.contains_begin (), + r.contains_end (), + edge_traverser ()); + } + + + // TranslationUnit + // + // + void TranslationUnit:: + traverse (SemanticGraph::TranslationUnit& u) + { + iterate_and_traverse (u.contains_begin (), + u.contains_end (), + edge_traverser ()); + } + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Translation.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Translation.hpp new file mode 100644 index 00000000000..7fc3f58c5d4 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Translation.hpp @@ -0,0 +1,107 @@ +// file : CCF/IDL2/Traversal/Translation.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_TRANSLATION_HPP +#define CCF_IDL2_TRAVERSAL_TRANSLATION_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" + +#include "CCF/IDL2/SemanticGraph/Translation.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // Some edges. + // + // + struct ContainsPrincipal : Edge<SemanticGraph::ContainsPrincipal> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.element ()); + } + }; + + struct ContainsImplied : Edge<SemanticGraph::ContainsImplied> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.element ()); + } + }; + + struct ContainsRoot : Edge<SemanticGraph::ContainsRoot> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.element ()); + } + }; + + struct Includes : Edge<SemanticGraph::Includes> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.element ()); + } + }; + + struct QuoteIncludes : Edge<SemanticGraph::QuoteIncludes> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.element ()); + } + }; + + struct BracketIncludes : Edge<SemanticGraph::BracketIncludes> + { + virtual void + traverse (Type& e) + { + node_traverser ().traverse (e.element ()); + } + }; + + + // + // + // + typedef + ScopeTemplate <SemanticGraph::Root> + Root; + + + // + // + // + struct TranslationRegion : Node<SemanticGraph::TranslationRegion> + { + virtual void + traverse (SemanticGraph::TranslationRegion&); + }; + + + // + // + // + struct TranslationUnit : Node<SemanticGraph::TranslationUnit> + { + virtual void + traverse (SemanticGraph::TranslationUnit&); + }; + + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_TRANSLATION_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/TypeId.cpp b/CIAO/CCF/CCF/IDL2/Traversal/TypeId.cpp new file mode 100644 index 00000000000..1e42505b5d7 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/TypeId.cpp @@ -0,0 +1,16 @@ +// file : CCF/IDL2/Traversal/TypeId.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/TypeId.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + } + } +} + diff --git a/CIAO/CCF/CCF/IDL2/Traversal/TypeId.hpp b/CIAO/CCF/CCF/IDL2/Traversal/TypeId.hpp new file mode 100644 index 00000000000..eb917dd69cb --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/TypeId.hpp @@ -0,0 +1,34 @@ +// file : CCF/IDL2/Traversal/TypeId.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_TYPE_ID_HPP +#define CCF_IDL2_TRAVERSAL_TYPE_ID_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" + +#include "CCF/IDL2/SemanticGraph/TypeId.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // Typeid and typeprefix are two idiotic constructs of IDL. + // They normally should not result in any directly generated + // code so only minimal (and most generic) support is provided. + // + + struct TypeId : Node<SemanticGraph::TypeId> + { + }; + + struct TypePrefix : Node<SemanticGraph::TypePrefix> + { + }; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_TYPE_ID_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Union.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Union.cpp new file mode 100644 index 00000000000..b14f518983e --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Union.cpp @@ -0,0 +1,81 @@ +// file : CCF/IDL2/Traversal/Union.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Union.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // UnionMember + // + // + void UnionMember:: + traverse (Type& m) + { + pre (m); + belongs (m); + name (m); + post (m); + } + + void UnionMember:: + pre (Type&) + { + } + + void UnionMember:: + belongs (Type& m, EdgeDispatcherBase& d) + { + d.traverse (m.belongs ()); + } + + void UnionMember:: + belongs (Type& m) + { + belongs (m, edge_traverser ()); + } + + void UnionMember:: + name (Type&) + { + } + + void UnionMember:: + post (Type&) + { + } + + + // Union + // + // + void Union:: + traverse (Type& s) + { + pre (s); + name (s); + names (s); + post (s); + } + + void Union:: + pre (Type&) + { + } + + void Union:: + name (Type&) + { + } + + void Union:: + post (Type&) + { + } + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Union.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Union.hpp new file mode 100644 index 00000000000..2bcad1eb4ea --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/Union.hpp @@ -0,0 +1,63 @@ +// file : CCF/IDL2/Traversal/Union.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_UNION_HPP +#define CCF_IDL2_TRAVERSAL_UNION_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/Union.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // + // + // + struct UnionMember : Node<SemanticGraph::UnionMember> + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + belongs (Type&, EdgeDispatcherBase&); + + virtual void + belongs (Type&); + + virtual void + name (Type&); + + virtual void + post (Type&); + }; + + + // + // + // + struct Union : ScopeTemplate<SemanticGraph::Union> + { + virtual void + traverse (Type&); + + virtual void + pre (Type&); + + virtual void + name (Type&); + + virtual void + post (Type&); + }; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_UNION_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/ValueType.cpp b/CIAO/CCF/CCF/IDL2/Traversal/ValueType.cpp new file mode 100644 index 00000000000..63dce1325df --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/ValueType.cpp @@ -0,0 +1,15 @@ +// file : CCF/IDL2/Traversal/ValueType.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/ValueType.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/ValueType.hpp b/CIAO/CCF/CCF/IDL2/Traversal/ValueType.hpp new file mode 100644 index 00000000000..a99ee48e814 --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/ValueType.hpp @@ -0,0 +1,89 @@ +// file : CCF/IDL2/Traversal/ValueType.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_VALUE_TYPE_HPP +#define CCF_IDL2_TRAVERSAL_VALUE_TYPE_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" +#include "CCF/IDL2/Traversal/Operation.hpp" +#include "CCF/IDL2/SemanticGraph/ValueType.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + template <typename T> + struct ValueTypeTemplate : ScopeTemplate<T> + { + virtual void + traverse (T&); + + virtual void + pre (T&); + + virtual void + name (T&); + + virtual void + inherits (T&, EdgeDispatcherBase& d); + + virtual void + inherits (T&); + + virtual void + inherits_pre (T&); + + virtual void + inherits_post (T&); + + virtual void + inherits_none (T&); + + virtual void + supports (T&, EdgeDispatcherBase& d); + + virtual void + supports (T&); + + virtual void + supports_pre (T&); + + virtual void + supports_post (T&); + + virtual void + supports_none (T&); + + virtual void + post (T&); + + virtual void + comma (T&); + }; + + + typedef + ValueTypeTemplate<SemanticGraph::ValueType> + ValueType; + + typedef + ValueTypeTemplate<SemanticGraph::AbstractValueType> + AbstractValueType; + + typedef + ValueTypeTemplate<SemanticGraph::ConcreteValueType> + ConcreteValueType; + + typedef + OperationTemplate<SemanticGraph::ValueTypeFactory> + ValueTypeFactory; + } + } +} + +#include "CCF/IDL2/Traversal/ValueType.tpp" + +#endif // CCF_IDL2_TRAVERSAL_VALUE_TYPE_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/ValueType.tpp b/CIAO/CCF/CCF/IDL2/Traversal/ValueType.tpp new file mode 100644 index 00000000000..e5582c4c61b --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/ValueType.tpp @@ -0,0 +1,150 @@ +// file : CCF/IDL2/Traversal/ValueType.tpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + template <typename T> + void ValueTypeTemplate<T>:: + traverse (T& v) + { + pre (v); + name (v); + inherits (v); + supports (v); + names (v); + post (v); + } + + template <typename T> + void ValueTypeTemplate<T>:: + pre (T&) + { + } + + template <typename T> + void ValueTypeTemplate<T>:: + name (T&) + { + } + + template <typename T> + void ValueTypeTemplate<T>:: + inherits (T& v, EdgeDispatcherBase& d) + { + iterate_and_traverse (v.inherits_begin (), + v.inherits_end (), + d); + } + + template <typename T> + void ValueTypeTemplate<T>:: + inherits (T& v) + { + typename T::InheritsIterator + b (v.inherits_begin ()), e (v.inherits_end ()); + + if (b != e) + { + inherits_pre (v); + iterate_and_traverse (b, + e, + this->edge_traverser (), + *this, + &ValueTypeTemplate::comma, + v); + inherits_post (v); + } + else + { + inherits_none (v); + } + } + + template <typename T> + void ValueTypeTemplate<T>:: + inherits_pre (T&) + { + } + + template <typename T> + void ValueTypeTemplate<T>:: + inherits_post (T&) + { + } + + template <typename T> + void ValueTypeTemplate<T>:: + inherits_none (T&) + { + } + + template <typename T> + void ValueTypeTemplate<T>:: + supports (T& v, EdgeDispatcherBase& d) + { + iterate_and_traverse (v.supports_begin (), + v.supports_end (), + d); + } + + template <typename T> + void ValueTypeTemplate<T>:: + supports (T& v) + { + typename T::SupportsIterator + b (v.supports_begin ()), e (v.supports_end ()); + + if (b != e) + { + supports_pre (v); + iterate_and_traverse (b, + e, + this->edge_traverser (), + *this, + &ValueTypeTemplate::comma, + v); + supports_post (v); + } + else + { + supports_none (v); + } + } + + template <typename T> + void ValueTypeTemplate<T>:: + supports_pre (T&) + { + } + + template <typename T> + void ValueTypeTemplate<T>:: + supports_post (T&) + { + } + + template <typename T> + void ValueTypeTemplate<T>:: + supports_none (T&) + { + } + + template <typename T> + void ValueTypeTemplate<T>:: + post (T&) + { + } + + template <typename T> + void ValueTypeTemplate<T>:: + comma (T&) + { + } + } + } +} diff --git a/CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.hpp b/CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.hpp new file mode 100644 index 00000000000..f579f7d765d --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.hpp @@ -0,0 +1,59 @@ +// file : CCF/IDL2/Traversal/ValueTypeMember.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_VALUE_TYPE_MEMBER_HPP +#define CCF_IDL2_TRAVERSAL_VALUE_TYPE_MEMBER_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" + +#include "CCF/IDL2/SemanticGraph/ValueTypeMember.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + template <typename T> + struct ValueTypeMemberTemplate : Node<T> + { + virtual void + traverse (T&); + + virtual void + pre (T&); + + virtual void + belongs (T&, EdgeDispatcherBase&); + + virtual void + belongs (T&); + + virtual void + name (T&); + + virtual void + post (T&); + + using Node<T>::edge_traverser; + }; + + typedef + ValueTypeMemberTemplate<SemanticGraph::ValueTypeMember> + ValueTypeMember; + + typedef + ValueTypeMemberTemplate<SemanticGraph::ValueTypePrivateMember> + ValueTypePrivateMember; + + typedef + ValueTypeMemberTemplate<SemanticGraph::ValueTypePublicMember> + ValueTypePublicMember; + } + } +} + +#include "CCF/IDL2/Traversal/ValueTypeMember.tpp" + +#endif // CCF_IDL2_TRAVERSAL_VALUE_TYPE_MEMBER_HPP diff --git a/CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.tpp b/CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.tpp new file mode 100644 index 00000000000..9629a9e056b --- /dev/null +++ b/CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.tpp @@ -0,0 +1,54 @@ +// file : CCF/IDL2/Traversal/ValueTypeMember.tpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + template <typename T> + void ValueTypeMemberTemplate<T>:: + traverse (T& m) + { + pre (m); + belongs (m); + name (m); + post (m); + } + + template <typename T> + void ValueTypeMemberTemplate<T>:: + pre (T&) + { + } + + template <typename T> + void ValueTypeMemberTemplate<T>:: + belongs (T& m, EdgeDispatcherBase& d) + { + d.traverse (m.belongs ()); + } + + template <typename T> + void ValueTypeMemberTemplate<T>:: + belongs (T& m) + { + belongs (m, edge_traverser ()); + } + + template <typename T> + void ValueTypeMemberTemplate<T>:: + name (T&) + { + } + + template <typename T> + void ValueTypeMemberTemplate<T>:: + post (T&) + { + } + } + } +} |