19 #define DATASVC_REGISTRYENTRY_CPP 38 #define CAST_REGENTRY( x, y ) dynamic_cast<x>( y ) 44 : m_path(
std::move(
path ) ), m_pParent( parent ) {
47 if ( sep != std::string::npos )
m_path.
erase( 0, sep );
56 if ( !m_isSoft ) m_pObject->setRegistry(
nullptr );
60 if ( !m_isSoft ) m_pAddress->setRegistry(
nullptr );
61 m_pAddress->release();
67 unsigned long cnt = --m_refCount;
68 if ( !m_refCount )
delete this;
76 assemblePath( m_fullpath );
91 setAddress( pAddress );
98 if ( m_pObject ) m_pObject->setRegistry(
this );
99 if ( m_pAddress ) m_pAddress->setRegistry(
this );
105 setAddress( pAddress );
114 if ( m_pAddress ) m_pAddress->release();
115 m_pAddress = pAddress;
124 if ( m_pObject ) m_pObject->release();
135 m_store.erase( i,
std::end( m_store ) );
138 return m_store.size();
143 if ( nam.front() ==
SEPARATOR ) nam.remove_prefix( 1 );
144 auto i =
std::find_if( m_store.begin(), m_store.end(), [&](
const auto* entry ) {
146 return entry->name().compare( 1, std::string::npos, nam.data(), nam.size() ) == 0;
166 return i_add( pEntry );
180 m_store.push_back( pEntry );
184 return m_store.size();
207 for (
auto& i : m_store ) {
214 m_store.erase( m_store.begin(), m_store.end() );
220 auto i =
std::find( m_store.begin(), m_store.end(), obj );
221 return ( i != m_store.end() ) ? ( *i ) :
nullptr;
227 while ( !
path.empty() ) {
232 auto cpath =
path.substr( 0, loc1 );
233 if ( loc1 != std::string_view::npos ) {
234 path.remove_prefix( loc1 + 1 );
236 path = std::string_view{};
239 [&](
const auto& reg ) {
return cpath == std::string_view{reg->name()}.substr( 1 ); } );
246 if ( cpath != std::string_view{m_path}.substr( 1 ) )
break;
254 if ( key == m_pObject )
return const_cast<RegistryEntry*>(
this );
257 if ( result )
return result;
259 for (
const auto& i : m_store ) {
262 result = entry->
i_find( key );
263 if ( result )
return result;
275 for (
auto& i : m_store ) {
287 if ( m_pParent ) m_pParent->assemblePath( buffer );
long deleteElements()
Delete all contained elements.
IRegistry * registry() const
Get pointer to Registry.
StatusCode traverseTree(IDataStoreAgent *pAgent, int level=0)
traverse data tree
virtual bool analyse(IRegistry *pObject, int level)=0
Analyse the data object.
unsigned long addRef() override
IInterface implementation: Dereference the object.
~RegistryEntry() override
Standard Destructor.
constexpr static const auto SUCCESS
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
unsigned long release() override
IInterface implementation: Reference the object.
#define CAST_REGENTRY(x, y)
virtual const name_type & name() const =0
Name of the directory (or key)
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
long i_add(RegistryEntry *entry)
Internal method to add entries.
std::string m_fullpath
String containing full path of the object (volatile)
void setParent(RegistryEntry *pParent)
Set new parent pointer.
virtual unsigned long addRef()
Add reference to object.
void setObject(DataObject *obj)
Set/Update object address.
IOpaqueAddress * address() const override
Retrieve opaque storage address.
void assemblePath(std::string &buffer) const
The following entries serve two aspects: 1) They are faster for recursive calls, because they are non...
This class is used for returning status codes from appropriate routines.
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
StatusCode remove(std::string_view name)
Remove an entry from the store.
void makeSoft(DataObject *pObject)
Initialize link as soft link.
RegistryEntry * i_create(std::string name)
Internal method to create entries.
Definition of an entry in the transient data store.
const StatusCode & ignore() const
Ignore/check StatusCode.
StatusCode add(std::string name, DataObject *pObject, bool is_soft=false)
Add entry to data store.
Generic data agent interface.
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
constexpr static const auto FAILURE
std::string m_path
Path name.
bool isSoft() const
Is the link soft or hard.
virtual void setRegistry(IRegistry *r)=0
Update directory pointer.
Opaque address interface definition.
A DataObject is the base class of any identifiable object on any data store.
virtual unsigned long addRef()=0
Add reference to object.
void makeHard(DataObject *pObject)
Initialize link as hard link.