diff options
author | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-12-22 22:26:40 +0000 |
---|---|---|
committer | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-12-22 22:26:40 +0000 |
commit | 1d3f996176b9b84a7707a93bacb7befdc0390e78 (patch) | |
tree | d3b78fd9ec6c1c3660975fee2e15f28e62939746 /TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.tpp | |
parent | 802456f32627d7c5f455164946bb024624b68beb (diff) | |
download | ATCD-1d3f996176b9b84a7707a93bacb7befdc0390e78.tar.gz |
ChangeLogTag: Mon Dec 22 16:26:21 2003 Boris Kolpackov <boris@dre.vanderbilt.edu>
Diffstat (limited to 'TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.tpp')
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.tpp | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.tpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.tpp new file mode 100644 index 00000000000..d4dd0bbeeb9 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.tpp @@ -0,0 +1,95 @@ +// file : CCF/IDL2/SemanticAction/Impl/Elements.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticAction + { + namespace Impl + { + template <typename T> + T& Base:: + resolve (SemanticGraph::ScopedName const& from, + SemanticGraph::Name const& name, + Flags flags) + throw (NotFound, NotUnique, WrongType, NotDefined, NotComplete) + { + using namespace SemanticGraph; + + try + { + ScopedName from (ctx.scope ().scoped_name ()); + Nameables nodes (Impl::resolve (ctx.tu (), from, name)); + + + if (nodes.size () != 1) throw NotUnique (); + + Nameable& node (**(nodes.begin ())); + + try + { + T& t (dynamic_cast<T&> (node)); + + if (flags & defined) + { + if (!t.defined ()) throw NotDefined (node.scoped_name ()); + } + + if (flags & complete) + { + SemanticGraph::Type& type ( + dynamic_cast<SemanticGraph::Type&> (t)); + + if (!type.complete ()) + { + throw NotComplete (node.scoped_name ()); + } + } + + return t; + } + catch (std::bad_cast const&) + { + throw WrongType (node.scoped_name ()); + } + } + catch (Impl::NotFound const&) + { + throw NotFound (); + } + } + + template<typename I> + void Base:: + check_inheritance (I begin, I end, SemanticGraph::Nameable& t) + throw (AlreadyInherited) + { + for (;begin != end; ++begin) + { + if ((**begin).inheritee () == t) + { + throw AlreadyInherited (t.scoped_name ()); + } + } + } + + template<typename I> + void Base:: + check_support (I begin, I end, SemanticGraph::Nameable& t) + throw (AlreadySupported) + { + for (;begin != end; ++begin) + { + if ((**begin).supportee () == t) + { + throw AlreadySupported (t.scoped_name ()); + } + } + } + } + } + } +} |