23#define CAST_REGENTRY( x, y ) dynamic_cast<x>( y )
25constexpr char SEPARATOR{
'/' };
30 std::string::size_type sep =
m_path.rfind( SEPARATOR );
31 if (
m_path.front() != SEPARATOR )
m_path.insert( 0, 1, SEPARATOR );
32 if ( sep != std::string::npos )
m_path.erase( 0, sep );
117 auto i = std::remove( std::begin(
m_store ), std::end(
m_store ), pEntry );
118 if ( i != std::end(
m_store ) ) {
128 if ( nam.front() == SEPARATOR ) nam.remove_prefix( 1 );
129 auto i = std::find_if(
m_store.begin(),
m_store.end(), [&](
const auto* entry ) {
131 return entry->name().compare( 1, std::string::npos, nam.data(), nam.size() ) == 0;
141 if ( nam.front() != SEPARATOR ) nam.insert( 0, 1, SEPARATOR );
145 return not_present ?
new RegistryEntry( std::move( nam ),
this ) :
nullptr;
151 return i_add( pEntry );
206 return ( i !=
m_store.end() ) ? ( *i ) :
nullptr;
211 if ( path.front() == SEPARATOR ) path.remove_prefix( 1 );
212 while ( !path.empty() ) {
216 auto loc1 = path.find( SEPARATOR );
217 auto cpath = path.substr( 0, loc1 );
218 if ( loc1 != std::string_view::npos ) {
219 path.remove_prefix( loc1 + 1 );
221 path = std::string_view{};
223 auto i = std::find_if( std::begin(
m_store ), std::end(
m_store ),
224 [&](
const auto& reg ) {
return cpath == std::string_view{ reg->name() }.substr( 1 ); } );
225 if ( i != std::end(
m_store ) ) {
227 return path.empty() ? regEnt : regEnt->
i_find( path );
231 if ( cpath != std::string_view{
m_path }.substr( 1 ) )
break;
242 if ( result )
return result;
244 for (
const auto& i :
m_store ) {
247 result = entry->
i_find( key );
248 if ( result )
return result;
257 bool go_down = pAgent->
analyse(
this, level );
#define CAST_REGENTRY(x, y)
A DataObject is the base class of any identifiable object on any data store.
virtual unsigned long addRef()
Add reference to object.
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition of an entry in the transient data store.
void setObject(DataObject *obj)
Set/Update object address.
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
~RegistryEntry() override
Standard Destructor.
std::string m_fullpath
String containing full path of the object (volatile)
unsigned long addRef() override
IInterface implementation: Dereference the object.
Store m_store
Store of leaves.
StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
unsigned long m_refCount
Reference counter.
RegistryEntry * i_create(std::string name)
Internal method to create entries.
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
IRegistry * parent() const
Pointer to parent directory entry.
void setParent(RegistryEntry *pParent)
Set new parent pointer.
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
void assemblePath(std::string &buffer) const
The following entries serve two aspects: 1) They are faster for recursive calls, because they are non...
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
bool isSoft() const
Is the link soft or hard.
RegistryEntry * m_pParent
Pointer to parent.
DataObject * m_pObject
Pointer to object.
bool m_isSoft
Is the link soft or hard?
long deleteElements()
Delete all contained elements.
long i_add(RegistryEntry *entry)
Internal method to add entries.
void makeSoft(DataObject *pObject)
Initialize link as soft link.
unsigned long release() override
IInterface implementation: Reference the object.
std::string m_path
Path name.
void makeHard(DataObject *pObject)
Initialize link as hard link.
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
IOpaqueAddress * address() const override
Retrieve opaque storage address.
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
StatusCode remove(std::string_view name)
Remove an entry from the store.
StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
const std::string & name() const override
Retrieve name of the entry.
Generic data agent interface.
virtual bool analyse(IRegistry *pObject, int level)=0
Analyse the data object.
Opaque address interface definition.
virtual void setRegistry(IRegistry *r)=0
Update directory pointer.
virtual unsigned long addRef()=0
Add reference to object.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
virtual const name_type & name() const =0
Name of the directory (or key)
This class is used for returning status codes from appropriate routines.
const StatusCode & ignore() const
Allow discarding a StatusCode without warning.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE