HOPS
HOPS class reference
Public Member Functions | List of all members
hops::MHO_ContainerFileInterface Class Reference

Class MHO_ContainerFileInterface - a MHO_ContainerDictionary which can read/write objects to file. More...

#include <MHO_ContainerFileInterface.hh>

Inheritance diagram for hops::MHO_ContainerFileInterface:
[legend]

Public Member Functions

 MHO_ContainerFileInterface ()
 
virtual ~MHO_ContainerFileInterface ()
 
void ConvertObjectInStoreToJSON (MHO_ContainerStore &store, const MHO_UUID &obj_uuid, mho_json &json_obj, int level_of_detail=eJSONBasic)
 Converts a specific object in store to JSON representation at given detail level. More...
 
void ConvertObjectInStoreToJSONAndRaw (MHO_ContainerStore &store, const MHO_UUID &obj_uuid, mho_json &json_obj, std::size_t &rank, const char *&raw_data, std::size_t &raw_data_byte_size, std::string &raw_data_descriptor, int level_of_detail=eJSONBasic)
 Converts an object in store to JSON and raw data, providing access to raw bytes for hops2flat. More...
 
void ConvertStoreToJSON (MHO_ContainerStore &store, mho_json &json_obj, int level_of_detail=eJSONBasic)
 Converts a container store to JSON representation with specified detail level. More...
 
void PopulateStoreFromFile (MHO_ContainerStore &store, bool do_clear_store=false)
 Populates a store from a file, optionally clearing it first. More...
 
void SetFilename (std::string filename)
 Setter for filename. More...
 
void SetIndexFileName (std::string index_filename)
 Setter for index file name. More...
 
void WriteStoreToFile (MHO_ContainerStore &store)
 Writes object in a MHO_ContainerStore to file using MHO_BinaryFileInterface and factory map. More...
 
- Public Member Functions inherited from hops::MHO_ContainerDictionary
 MHO_ContainerDictionary ()
 
virtual ~MHO_ContainerDictionary ()
 
- Public Member Functions inherited from hops::MHO_ClassIdentityMap
 MHO_ClassIdentityMap ()
 
virtual ~MHO_ClassIdentityMap ()
 
template<typename XClassType >
void AddClassType ()
 Function AddClassType, adds a class of a particular type to the identity map. More...
 
template<typename XClassType >
void AddClassType (const XClassType &obj)
 Function AddClassType, overload provided for passing object reference. More...
 
MHO_SerializableGenerateContainerFromUUID (const MHO_UUID &uuid)
 Generates a container from a UUID and returns a ptr to MHO_Serializable if found in factory map. More...
 
template<typename XClassType >
std::string GetClassNameFromObject (const XClassType &obj)
 Getter for class name from object. More...
 
std::string GetClassNameFromUUID (const MHO_UUID &uuid) const
 Getter for class name from uuid. More...
 
template<typename XClassType >
MHO_UUID GetUUIDFor () const
 Getter for uuid for a class type. More...
 
MHO_UUID GetUUIDFromClassName (const std::string &name) const
 Getter for uuid from class name. More...
 
bool IsTypePresent (const MHO_UUID &uuid) const
 Checks if a UUID is present in the class name map. More...
 

Additional Inherited Members

- Protected Member Functions inherited from hops::MHO_ClassIdentityMap
void AddToMap (const MHO_UUID &type_uuid, const std::string &name)
 Adds an entry to the UUID-name map and its reverse map. More...
 
- Protected Attributes inherited from hops::MHO_ClassIdentityMap
std::map< std::string, MHO_UUIDfClassName2UUID
 
std::map< MHO_UUID, MHO_SerializableObjectFactory * > fFactoryMap
 
std::map< MHO_UUID, MHO_JSONConverter * > fJSONConverterMap
 
MHO_MD5HashGenerator fMD5Generator
 
std::map< MHO_UUID, std::string > fUUID2ClassName
 

Detailed Description

Class MHO_ContainerFileInterface - a MHO_ContainerDictionary which can read/write objects to file.

Author
J. Barrett - barre.nosp@m.ttj@.nosp@m.mit.e.nosp@m.du
Date
Sun Feb 13 15:48:42 2022 -0500

Constructor & Destructor Documentation

◆ MHO_ContainerFileInterface()

hops::MHO_ContainerFileInterface::MHO_ContainerFileInterface ( )

◆ ~MHO_ContainerFileInterface()

hops::MHO_ContainerFileInterface::~MHO_ContainerFileInterface ( )
virtual

Member Function Documentation

◆ ConvertObjectInStoreToJSON()

void hops::MHO_ContainerFileInterface::ConvertObjectInStoreToJSON ( MHO_ContainerStore store,
const MHO_UUID obj_uuid,
mho_json json_obj,
int  level_of_detail = eJSONBasic 
)

Converts a specific object in store to JSON representation at given detail level.

Parameters
storeReference to MHO_ContainerStore for accessing objects and types.
obj_uuidUUID of the object to convert to JSON.
json_objReference to mho_json where converted object will be stored.
level_of_detailDetail level for converting the object.

◆ ConvertObjectInStoreToJSONAndRaw()

void hops::MHO_ContainerFileInterface::ConvertObjectInStoreToJSONAndRaw ( MHO_ContainerStore store,
const MHO_UUID obj_uuid,
mho_json json_obj,
std::size_t &  rank,
const char *&  raw_data,
std::size_t &  raw_data_byte_size,
std::string &  raw_data_descriptor,
int  level_of_detail = eJSONBasic 
)

Converts an object in store to JSON and raw data, providing access to raw bytes for hops2flat.

Parameters
storeReference to MHO_ContainerStore for accessing objects
obj_uuidUUID of the object to convert
json_objOutput mho_json object containing converted JSON representation
rankOutput rank of the converted object (specialization for RANK-0)
raw_dataOutput pointer to raw data bytes (null if not available)
raw_data_byte_sizeOutput size of raw data in bytes
raw_data_descriptorOutput string describing raw data
level_of_detailInput level of detail for conversion

◆ ConvertStoreToJSON()

void hops::MHO_ContainerFileInterface::ConvertStoreToJSON ( MHO_ContainerStore store,
mho_json json_obj,
int  level_of_detail = eJSONBasic 
)

Converts a container store to JSON representation with specified detail level.

Parameters
storeReference to MHO_ContainerStore object containing data to convert.
json_objReference to mho_json object that will hold the converted JSON data.
level_of_detailInteger specifying the level of detail for the JSON conversion.

◆ PopulateStoreFromFile()

void hops::MHO_ContainerFileInterface::PopulateStoreFromFile ( MHO_ContainerStore store,
bool  do_clear_store = false 
)

Populates a store from a file, optionally clearing it first.

currently this function reads the file keys and then the all the file objects note: we may want to split this functionality so we can inspect the file first and then only read the objects of interest

Parameters
storeReference to MHO_ContainerStore object
do_clear_storeBoolean flag indicating whether to clear the store before populating

◆ SetFilename()

void hops::MHO_ContainerFileInterface::SetFilename ( std::string  filename)

Setter for filename.

Parameters
filenameNew filename to set as a std::string

◆ SetIndexFileName()

void hops::MHO_ContainerFileInterface::SetIndexFileName ( std::string  index_filename)

Setter for index file name.

index file is optional, if we don't have an index file, the regular file will be read in 2-passes, first to extract the keys, then to extract the objects likewise, when writing a store to file, if there is no index file specified, none will be created

Parameters
index_filenameThe new index file name to set

◆ WriteStoreToFile()

void hops::MHO_ContainerFileInterface::WriteStoreToFile ( MHO_ContainerStore store)

Writes object in a MHO_ContainerStore to file using MHO_BinaryFileInterface and factory map.

Parameters
storeReference to MHO_ContainerStore containing objects to write.

The documentation for this class was generated from the following files: