Each C++ namespace is available as a Python object. The root namespace is made available in a Python global variable named 'cns' which stands for C++ Name Space.
Consider the following nested namespaces in C++
// C++ code
namespace a
{
namespace b
{
namespace c
{
$function+ void foo();
}
}
}
In Python the expressions cns.a, cns.a.b, cns.a.b.c denote namespaces a,b and c respectively. cns.a.b.c.foo denotes the reflected C++ function ::a::b::c::foo
Python expression | C++ expression |
---|---|
cns.a | ::a |
cns.a.b | ::a::b |
cns.a.b.c | ::a::b::c |
cns.a.b.c.foo | ::a::b::c::foo |
Many of the reflected entities in the ceda core system live in the C++ namespace named 'ceda'. In Python the expression 'cns.ceda' denotes a Python object which represents this C++ namespace.
The function 'dir' can be called on a namespace to get a list of all the elements of the namespace. For example the following Python code:
# python code
print `dir(cns.ceda)`
displays the following:
['AddGcRoot', 'AddPSpaceRoot', 'AnyConstInterface', 'AnyInterface', 'AsyncBindObjectInMemoryGivenOid', 'AsyncPermanentlyDeleteObject', 'AsyncPermanentlyDeleteSubTree', 'BPlusTree', 'BcTypeOps', 'BindObjectGivenOid', 'BindObjectInMemoryGivenOid', 'BindPathDownwards', 'BindPythonSysOutputToTracer', 'CSpace', 'CSpaceStack_Pop', 'CSpaceStack_Push', 'ChildNameSpaceIterator', 'ClassNameTranslation', 'ClassNameTranslationTable', 'CloseCSpaceStack', 'ClosePSpaceTxn', 'ConstString16Z', 'ConstString8Z', 'ConstStringZ', 'CreateCSpace', 'CreateCSpace2', 'Date', 'DeclareReachable', 'EAsyncBindResult', 'EByteCodeQualifier', 'ECSpaceLockMode', 'EFuncType', 'ENSType', 'ENameSpaceError', 'ENavNamespaceResult', 'EOpenMode', 'EReflectedClassBits', 'ERetMode', 'ETypeByteCode', 'FieldAddress', 'FindChildNameSpace', 'FindChildNsNodeWithLinearScan', 'FindElement', 'FindElementWithRelativePath', 'GCRoots', 'GCThreadFn', 'GetAssociatedCSpace', 'GetAssociatedLss', 'GetAssociatedPSpace', 'GetAssociatedPersistStore', 'GetChildNameSpaceIterator', 'GetClassMethodArgByteCode', 'GetClassMethodReturnTypeByteCode', 'GetElementIterator', 'GetEvictionThreshold', 'GetFieldByteCode', 'GetFunctorArgByteCode', 'GetFunctorReturnTypeByteCode', 'GetGlobalFunctionArgByteCode', 'GetGlobalFunctionReturnTypeByteCode', 'GetGlobalVariableByteCode', 'GetInterfaceAttributeByteCode', 'GetInterfaceMethodArgByteCode', 'GetInterfaceMethodReturnTypeByteCode', 'GetMaxNumDgsNodesToRetain', 'GetMetaData', 'GetMilliSecsPerGc', 'GetModelFieldByteCode', 'GetName', 'GetOid', 'GetPSpaceOfCSpace', 'GetPSpaceRoot', 'GetTheRootNameSpace', 'GetThreadCSpace', 'GetThreadPSpace', 'GetTypeDefByteCode', 'GetVariantFieldByteCode', 'Goid', 'Guid', 'HPTime', 'IAssignableFieldNotifications', 'IAsyncBindRequestHandler', 'IBiDirIterator', 'IKeyType', 'INsNode', 'IObject', 'IObjectVisitor', 'IOffsetableFieldNotifications', 'IOperationCallBacks', 'IPersistable', 'IPrefVisitor', 'IPythonSysOutCallBacks', 'ISetFieldNotifications', 'IVectorFieldNotifications', 'IXMap', 'IXSet', 'Int64', 'InternalNode', 'LeafNode', 'LockInfo', 'LssSettings', 'MAsyncBind', 'MGuid', 'MarkPersistentAsDirtyWithoutTrace', 'MetaData', 'NameSpace', 'NameSpaceElement', 'NameSpaceElementIterator', 'OID', 'ObjSysState', 'ObjectInThreadCSpace', 'ObjectsBelongToDifferentCSpaces', 'ObjectsBelongToDifferentPSpaces', 'ObjectsBelongToDifferentPersistStores', 'OidHigh', 'OidLow', 'OidSpaceGuid', 'OidSpaceMap', 'OnGarbageCollectPersistable', 'OpenCSpaceStack', 'OpenPSpace', 'OpenPSpaceTxn', 'OpenPersistStore', 'PSpace', 'PSpaceLockMode', 'PersistObjState', 'PersistStore', 'PersistStoreSettings', 'PersistStoreTxn', 'PythonCallback_WriteToStdErr', 'PythonCallback_WriteToStdOut', 'QualifiedByteCode', 'RSN', 'ReadMetaData', 'ReflectedArg', 'ReflectedAttribute', 'ReflectedClass', 'ReflectedClassMethod', 'ReflectedDepField', 'ReflectedEnum', 'ReflectedField', 'ReflectedFunction', 'ReflectedFunctor', 'ReflectedGlobalFunction', 'ReflectedGlobalVariable', 'ReflectedInterface', 'ReflectedInterfaceMethod', 'ReflectedModelField', 'ReflectedReturnType', 'ReflectedTypedef', 'ReflectedVariant', 'ReflectionByteCode', 'ReflectionByteCodeValue', 'RegisterGcObject', 'RegisterNonGcObject', 'RemoveGcRoot', 'RemovePSpaceRoot', 'SeidHigh', 'SeidLow', 'SetEvictableObjectSizeInBytes', 'SetEvictionThreshold', 'SetMaxNumDgsNodesToRetain', 'SetMilliSecsPerGc', 'SetThreadCSpace', 'SetThreadPSpace', 'SetTouched', 'SetTraceFile2', 'StartGc', 'StopGc', 'SubString', 'SubString16', 'SubString8', 'SyncPermanentlyDeleteObject', 'SyncPermanentlyDeleteSubTree', 'SynchronousDeepCopyPersistableObject', 'SynchronousGc', 'TIN', 'ThreadTaskFunctor', 'TransferCSpace', 'TryBindObjectGivenOid', 'TypeOpsId', 'UInt64', 'XTarget', 'dsTarget', 'ssize_t', 'xchar', 'xstring']
In many of the following examples we shall use a C++ namespace named 'ns' and assume there is a global Python variable named 'ns' which corresponds to this namespace.