38 #define NCBI_USE_ERRCODE_X Serial_DataTool
47 : m_NodesWithFunctions(nodesWithFunctions)
65 ITERATE( std::vector<CTraversalSpecFileParser::CDescFileNodeRef>, pattern_iter, spec_file_parser.
GetDescFileNodes() ) {
85 const string &last_node_in_pattern = pattern->GetPattern().back();
86 bool pattern_was_used =
false;
87 bool except_pattern_was_used =
false;
90 if( pattern->GetExceptPatterns().empty() ) {
91 except_pattern_was_used =
true;
95 if(
x_PatternMatches( (*node_iter), pattern->GetPattern().rbegin(), pattern->GetPattern().rend() ) ) {
98 except_pattern_was_used =
true;
102 pattern_was_used =
true;
110 if( ! pattern_was_used ) {
112 }
else if( ! except_pattern_was_used ) {
113 ERR_POST_X(2,
Warning <<
"Pattern exception was unused: " << pattern->ToString() );
121 const string &last_node_in_pattern = deprec_pattern.back();
122 bool pattern_was_used =
false;
125 if(
x_PatternMatches( (*node_iter), deprec_pattern.rbegin(), deprec_pattern.rend() ) ) {
126 pattern_was_used =
true;
127 nodes_to_destroy.insert( *node_iter );
133 if( ! pattern_was_used ) {
148 if(
x_PatternMatches( (*caller_iter)->GetNode(), pattern_start, pattern_end ) ) {
156 _ASSERT( pattern_start != pattern_end );
162 if( current_leaf ==
"?" ||
168 if( (pattern_start + 1) == pattern_end ) {
174 if(
x_PatternMatches( (*caller_iter)->GetNode(), pattern_start + 1, pattern_end ) ) {
190 if(
x_PatternMatches( node, pattern_iter->rbegin(), pattern_iter->rend() ) ) {
203 vector< CRef<CTraversalNode> > extra_arg_nodes;
209 extra_arg_nodes.push_back( arg_node );
232 const int levels_to_climb = (
int)(main_pattern.size() - extra_arg_pattern.size());
237 for( ; level_up < levels_to_climb; ++level_up ) {
238 if( current_node->
GetCallers().size() != 1 ) {
240 string msg(
"when using extra args, the extra args ");
241 msg +=
"must come from a 'direct' parent node. ";
242 msg +=
"That is, there must be only ONE path from the node ";
243 msg +=
"supplying the extra args to ";
244 msg +=
"the node that needs the extra arg, with only one ";
245 msg +=
"caller up to the top. ";
246 msg +=
"Main pattern: '";
248 msg +=
"', extra arg pattern: '";
251 throw runtime_error( msg );
253 current_node = (*(current_node->
GetCallers().begin()))->GetNode();
286 if( callers.empty() ) {
289 const string &
result = (*callers.begin())->GetVarName();
const std::string & GetTypeName() const
bool IsTemplate(void) const
const std::string & GetInputClassName(void) const
const TNodeCallSet & GetCallees(void) const
std::vector< CRef< CTraversalNode > > TNodeVec
std::set< CRef< CNodeCall >, SRefNodeCallLessthan > TNodeCallSet
void AddPostCalleesUserCall(CRef< CUserCall > user_call)
CRef< CTraversalNode > Ref()
void AddPreCalleesUserCall(CRef< CUserCall > user_call)
std::set< CRef< CTraversalNode > > TNodeSet
const TNodeCallSet & GetCallers(void) const
static const TNodeRawSet & GetEveryNode(void)
bool x_AnyPatternMatches(CRef< CTraversalNode > node, const CTraversalSpecFileParser::TPatternVec &patterns)
bool x_PatternMatches(CRef< CTraversalNode > node, TPatternIter pattern_start, TPatternIter pattern_end)
CTraversalNode::TNodeSet & m_NodesWithFunctions
const string & x_GetNodeVarName(const CTraversalNode &node)
CRef< CTraversalNode > x_TranslateArgToNode(CRef< CTraversalNode > node, const CTraversalSpecFileParser::TPattern &main_pattern, const CTraversalSpecFileParser::TPattern &extra_arg_pattern)
CTraversalPatternMatchCallback(CTraversalSpecFileParser &spec_file_parser, CTraversalNode::TNodeSet &out_nodesWithFunctions)
bool x_NodeIsUnmatchable(const CTraversalNode &node)
ERefChoice x_UseRefOrChild(const CTraversalNode &parent_ref, const CTraversalNode &child)
void x_TryToDeprecatePatternMatchers(const CTraversalSpecFileParser::TPattern &deprec_pattern, CTraversalNode::TNodeSet &nodes_to_destroy)
void x_TryToAttachPattern(CTraversalSpecFileParser::CDescFileNodeRef pattern)
void x_DoAttachment(CRef< CTraversalNode > node, CTraversalSpecFileParser::CDescFileNodeRef pattern)
TLeafToNodeMap m_LeafToPossibleNodes
std::vector< std::string >::const_reverse_iterator TPatternIter
std::vector< TPattern > TPatternVec
const TPatternVec & GetDeprecatedPatterns(void)
std::vector< std::string > TPattern
const std::vector< CRef< CDescFileNode > > & GetDescFileNodes(void) const
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
void Warning(CExceptionArgs_Base &args)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
unsigned int
A callback function used to compare two keys in a database.
Definition of all error codes used in serial libraries (xser.lib, xcser.lib).