NCBI C++ ToolKit
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CTraversalNode Class Reference

Search Toolkit Book for CTraversalNode

#include "traversal_node.hpp"
(Private to src/serial/datatool.)

+ Inheritance diagram for CTraversalNode:
+ Collaboration diagram for CTraversalNode:


struct  CCRefUserCallLessThan
class  CDepthFirstCallback
class  CNodeCall
class  CUserCall
struct  SRefNodeCallLessthan

Public Types

enum  FTraversalOpts { fTraversalOpts_Post = 1<<0 , fTraversalOpts_UpCallers = 1<<1 , fTraversalOpts_AllowCycles = 1<<2 }
enum  EGenerateMode { eGenerateMode_Prototypes = 0 , eGenerateMode_Definitions }
enum  EType {
  eType_Sequence = 0 , eType_Choice , eType_Primitive , eType_Null ,
  eType_Enum , eType_Reference , eType_UniSequence
enum  EMergeNameAllowed { eMergeNameAllowed_AllowNameChange = 1 , eMergeNameAllowed_ForbidNameChange }
typedef std::set< CRef< CTraversalNode > > TNodeSet
typedef std::set< CRef< CNodeCall >, SRefNodeCallLessthanTNodeCallSet
typedef std::vector< CRef< CTraversalNode > > TNodeVec
typedef unsigned int TTraversalOpts
typedef std::vector< CRef< CUserCall > > TUserCallVec
typedef set< CTraversalNode * > TNodeRawSet
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern }
 Control filling of newly allocated memory. More...
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
typedef atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
typedef Uint8 TCount
 Alias for value type of counter. More...

Public Member Functions

void AddCaller (const std::string &var_name, CRef< CTraversalNode > caller)
void DepthFirst (CDepthFirstCallback &callback, TTraversalOpts traversal_opts=0)
void GenerateCode (const string &func_class_name, CNcbiOstream &traversal_output_file, EGenerateMode generate_mode)
void SplitByVarName (void)
CRef< CTraversalNodeRef ()
const std::stringGetFuncName (void) const
const TNodeCallSetGetCallers (void) const
const TNodeCallSetGetCallees (void) const
const std::stringGetTypeName () const
EType GetType () const
const stringGetTypeAsString (void) const
const std::stringGetIncludePath (void) const
const std::stringGetInputClassName (void) const
bool IsTemplate (void) const
const TUserCallVecGetPostCalleesUserCalls () const
const TUserCallVecGetPreCalleesUserCalls () const
const string GetStoredArgVariable (void) const
bool GetDoStoreArg (void) const
void SetDoStoreArg (void)
void AddPreCalleesUserCall (CRef< CUserCall > user_call)
void AddPostCalleesUserCall (CRef< CUserCall > user_call)
void RemoveXFromFuncName (void)
bool Merge (CRef< CTraversalNode > node_to_merge_into_this, EMergeNameAllowed merge_name_allowed=eMergeNameAllowed_AllowNameChange)
void Clear (void)
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 CObject (const CObject &src)
 Copy constructor. More...
virtual ~CObject (void)
 Destructor. More...
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
void AddReference (void) const
 Add reference to object. More...
void RemoveReference (void) const
 Remove reference to object. More...
void ReleaseReference (void) const
 Remove reference without deleting object. More...
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
void * operator new (size_t size)
 Define new operator for memory allocation. More...
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
void * operator new (size_t size, void *place)
 Define new operator. More...
void operator delete (void *ptr, void *place)
 Define delete operator. More...
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
virtual ~CDebugDumpable (void)
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
void DumpToConsole (void) const

Static Public Member Functions

static CRef< CTraversalNodeCreate (CRef< CTraversalNode > caller, const string &var_name, CDataType *asn_node)
static const TNodeRawSetGetEveryNode (void)
- Static Public Member Functions inherited from CObject
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (const type_info &type)
static EAllocFillMode GetAllocFillMode (void)
static void SetAllocFillMode (EAllocFillMode mode)
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)

Private Types

typedef set< CConstRef< CUserCall >, CCRefUserCallLessThanTUserCallSet
typedef std::map< CDataType *, CRef< CTraversalNode > > TASNNodeToNodeMap

Private Member Functions

 CTraversalNode (CRef< CTraversalNode > parent, const string &var_name, CDataType *asn_node)
 ~CTraversalNode (void)
 CTraversalNode (void)
 CTraversalNode (const CTraversalNode &other)
CTraversalNodeoperator= (const CTraversalNode &other)
void x_LoadDataFromASNNode (CDataType *asn_node)
void x_DepthFirst (CDepthFirstCallback &callback, TNodeVec &node_path, TNodeSet &nodesSeen, TTraversalOpts traversal_opts)
void x_GenerateChildCall (CNcbiOstream &traversal_output_file, CRef< CTraversalNode > child, const string &arg)
void x_TemplatizeType (std::string &type_name)
bool x_IsSeqFeat (void)
CRef< CTraversalNodex_CloneWithoutCallers (const string &var_name) const
string x_ExtractIncludePathFromFileName (const string &asn_file_name)

Static Private Member Functions

static void x_MergeNames (string &result, const string &name1, const string &name2)

Private Attributes

TNodeCallSet m_Callees
TNodeCallSet m_Callers
TUserCallVec m_PreCalleesUserCalls
TUserCallVec m_PostCalleesUserCalls
TUserCallVec m_ReferencingUserCalls
EType m_Type
std::string m_TypeName
std::string m_InputClassName
std::string m_IncludePath
std::string m_FuncName
bool m_IsTemplate
bool m_DoStoreArg

Static Private Attributes

static TASNNodeToNodeMap m_ASNNodeToNodeMap
static set< CTraversalNode * > * ms_EveryNode = new set<CTraversalNode*>
static int ms_FuncUniquerInt = 0

Additional Inherited Members

- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...

Detailed Description

Definition at line 42 of file traversal_node.hpp.

Member Typedef Documentation

◆ TASNNodeToNodeMap

Definition at line 256 of file traversal_node.hpp.

◆ TNodeCallSet

Definition at line 66 of file traversal_node.hpp.

◆ TNodeRawSet

Definition at line 181 of file traversal_node.hpp.

◆ TNodeSet

Definition at line 65 of file traversal_node.hpp.

◆ TNodeVec

typedef std::vector< CRef<CTraversalNode> > CTraversalNode::TNodeVec

Definition at line 67 of file traversal_node.hpp.

◆ TTraversalOpts

Definition at line 95 of file traversal_node.hpp.

◆ TUserCallSet

Definition at line 205 of file traversal_node.hpp.

◆ TUserCallVec

typedef std::vector< CRef<CUserCall> > CTraversalNode::TUserCallVec

Definition at line 142 of file traversal_node.hpp.

Member Enumeration Documentation

◆ EGenerateMode


Definition at line 99 of file traversal_node.hpp.

◆ EMergeNameAllowed


Definition at line 167 of file traversal_node.hpp.

◆ EType

enum CTraversalNode::EType ( void  )

Definition at line 107 of file traversal_node.hpp.

◆ FTraversalOpts


Definition at line 90 of file traversal_node.hpp.

Constructor & Destructor Documentation

◆ CTraversalNode() [1/3]

CTraversalNode::CTraversalNode ( CRef< CTraversalNode parent,
const string var_name,
CDataType asn_node 

◆ ~CTraversalNode()

CTraversalNode::~CTraversalNode ( void  )

Definition at line 105 of file traversal_node.cpp.

References set< Key, Compare >::erase(), and ms_EveryNode.

◆ CTraversalNode() [2/3]

CTraversalNode::CTraversalNode ( void  )

Definition at line 99 of file traversal_node.cpp.

References set< Key, Compare >::insert(), and ms_EveryNode.

Referenced by Create().

◆ CTraversalNode() [3/3]

CTraversalNode::CTraversalNode ( const CTraversalNode other)

Member Function Documentation

◆ AddCaller()

void CTraversalNode::AddCaller ( const std::string var_name,
CRef< CTraversalNode caller 

◆ AddPostCalleesUserCall()

void CTraversalNode::AddPostCalleesUserCall ( CRef< CUserCall user_call)

◆ AddPreCalleesUserCall()

void CTraversalNode::AddPreCalleesUserCall ( CRef< CUserCall user_call)

Definition at line 460 of file traversal_node.cpp.

References m_PreCalleesUserCalls.

Referenced by CTraversalPatternMatchCallback::x_DoAttachment().

◆ Clear()

void CTraversalNode::Clear ( void  )

◆ Create()

CRef< CTraversalNode > CTraversalNode::Create ( CRef< CTraversalNode caller,
const string var_name,
CDataType asn_node 

Definition at line 59 of file traversal_node.cpp.

References CTraversalNode().

Referenced by CTraversalCodeGenerator::x_CreateNode().

◆ DepthFirst()

void CTraversalNode::DepthFirst ( CDepthFirstCallback callback,
TTraversalOpts  traversal_opts = 0 

Definition at line 420 of file traversal_node.cpp.

References x_DepthFirst().

◆ GenerateCode()

void CTraversalNode::GenerateCode ( const string func_class_name,
CNcbiOstream traversal_output_file,
EGenerateMode  generate_mode 

◆ GetCallees()

const TNodeCallSet& CTraversalNode::GetCallees ( void  ) const

◆ GetCallers()

const TNodeCallSet& CTraversalNode::GetCallers ( void  ) const

◆ GetDoStoreArg()

bool CTraversalNode::GetDoStoreArg ( void  ) const

◆ GetEveryNode()

static const TNodeRawSet& CTraversalNode::GetEveryNode ( void  )

◆ GetFuncName()

const std::string& CTraversalNode::GetFuncName ( void  ) const

Definition at line 144 of file traversal_node.hpp.

References m_FuncName.

Referenced by CTraversalMerger::x_DoTier().

◆ GetIncludePath()

const std::string& CTraversalNode::GetIncludePath ( void  ) const

Definition at line 150 of file traversal_node.hpp.

References m_IncludePath.

Referenced by CGenerateIncludesCallback::Call().

◆ GetInputClassName()

const std::string& CTraversalNode::GetInputClassName ( void  ) const

◆ GetPostCalleesUserCalls()

const TUserCallVec& CTraversalNode::GetPostCalleesUserCalls ( ) const

◆ GetPreCalleesUserCalls()

const TUserCallVec& CTraversalNode::GetPreCalleesUserCalls ( ) const

◆ GetStoredArgVariable()

const string CTraversalNode::GetStoredArgVariable ( void  ) const

◆ GetType()

EType CTraversalNode::GetType ( void  ) const

◆ GetTypeAsString()

const string & CTraversalNode::GetTypeAsString ( void  ) const

◆ GetTypeName()

const std::string& CTraversalNode::GetTypeName ( void  ) const

◆ IsTemplate()

bool CTraversalNode::IsTemplate ( void  ) const

◆ Merge()

bool CTraversalNode::Merge ( CRef< CTraversalNode node_to_merge_into_this,
EMergeNameAllowed  merge_name_allowed = eMergeNameAllowed_AllowNameChange 

◆ operator=()

CTraversalNode& CTraversalNode::operator= ( const CTraversalNode other)

◆ Ref()

CRef<CTraversalNode> CTraversalNode::Ref ( void  )

◆ RemoveXFromFuncName()

void CTraversalNode::RemoveXFromFuncName ( void  )

Definition at line 470 of file traversal_node.cpp.

References m_FuncName, and NStr::StartsWith().

Referenced by CTraversalCodeGenerator::CTraversalCodeGenerator().

◆ SetDoStoreArg()

void CTraversalNode::SetDoStoreArg ( void  )

Definition at line 159 of file traversal_node.hpp.

References m_DoStoreArg.

Referenced by CTraversalPatternMatchCallback::x_DoAttachment().

◆ SplitByVarName()

void CTraversalNode::SplitByVarName ( void  )

Definition at line 377 of file traversal_node.cpp.

References AddCaller(), Clear(), ITERATE, m_Callers, and x_CloneWithoutCallers().

◆ x_CloneWithoutCallers()

CRef< CTraversalNode > CTraversalNode::x_CloneWithoutCallers ( const string var_name) const

◆ x_DepthFirst()

void CTraversalNode::x_DepthFirst ( CDepthFirstCallback callback,
TNodeVec node_path,
TNodeSet nodesSeen,
TTraversalOpts  traversal_opts 

◆ x_ExtractIncludePathFromFileName()

string CTraversalNode::x_ExtractIncludePathFromFileName ( const string asn_file_name)

Definition at line 688 of file traversal_node.cpp.

References NStr::ReplaceInPlace(), and result.

Referenced by x_LoadDataFromASNNode().

◆ x_GenerateChildCall()

void CTraversalNode::x_GenerateChildCall ( CNcbiOstream traversal_output_file,
CRef< CTraversalNode child,
const string arg 

Definition at line 592 of file traversal_node.cpp.

References eType_Null, m_FuncName, m_InputClassName, and m_Type.

Referenced by GenerateCode().

◆ x_IsSeqFeat()

bool CTraversalNode::x_IsSeqFeat ( void  )

Definition at line 640 of file traversal_node.cpp.

References eType_Reference, m_InputClassName, and m_Type.

Referenced by GenerateCode().

◆ x_LoadDataFromASNNode()

void CTraversalNode::x_LoadDataFromASNNode ( CDataType asn_node)

◆ x_MergeNames()

void CTraversalNode::x_MergeNames ( string result,
const string name1,
const string name2 

Definition at line 646 of file traversal_node.cpp.

References NStr::EndsWith(), and result.

Referenced by Merge().

◆ x_TemplatizeType()

void CTraversalNode::x_TemplatizeType ( std::string type_name)

Definition at line 615 of file traversal_node.cpp.

References NStr::ReplaceInPlace(), result, NStr::ToLower(), toupper(), and type_name().

Referenced by x_LoadDataFromASNNode().

Member Data Documentation

◆ m_ASNNodeToNodeMap

CTraversalNode::TASNNodeToNodeMap CTraversalNode::m_ASNNodeToNodeMap

Definition at line 257 of file traversal_node.hpp.

Referenced by CTraversalNode().

◆ m_Callees

TNodeCallSet CTraversalNode::m_Callees

◆ m_Callers

TNodeCallSet CTraversalNode::m_Callers

Definition at line 232 of file traversal_node.hpp.

Referenced by AddCaller(), Clear(), GetCallers(), Merge(), SplitByVarName(), and x_DepthFirst().

◆ m_DoStoreArg

bool CTraversalNode::m_DoStoreArg

◆ m_FuncName

std::string CTraversalNode::m_FuncName

◆ m_IncludePath

std::string CTraversalNode::m_IncludePath

◆ m_InputClassName

std::string CTraversalNode::m_InputClassName

◆ m_IsTemplate

bool CTraversalNode::m_IsTemplate

◆ m_PostCalleesUserCalls

TUserCallVec CTraversalNode::m_PostCalleesUserCalls

◆ m_PreCalleesUserCalls

TUserCallVec CTraversalNode::m_PreCalleesUserCalls

◆ m_ReferencingUserCalls

TUserCallVec CTraversalNode::m_ReferencingUserCalls

Definition at line 237 of file traversal_node.hpp.

Referenced by Clear(), Merge(), and x_CloneWithoutCallers().

◆ m_Type

EType CTraversalNode::m_Type

◆ m_TypeName

std::string CTraversalNode::m_TypeName

◆ ms_EveryNode

set< CTraversalNode * > * CTraversalNode::ms_EveryNode = new set<CTraversalNode*>

Definition at line 267 of file traversal_node.hpp.

Referenced by CTraversalNode(), GetEveryNode(), and ~CTraversalNode().

◆ ms_FuncUniquerInt

int CTraversalNode::ms_FuncUniquerInt = 0

Definition at line 271 of file traversal_node.hpp.

Referenced by x_CloneWithoutCallers().

The documentation for this class was generated from the following files:
Modified on Mon Jun 24 05:23:27 2024 by rev. 669887