AAO DRAMA/DRAMA2 C++ Interface
DRAMA C++11 and later interface

◆ Get() [1/4]

virtual void drama::gitarg::Id::Get ( const sds::Id Id,
const std::string &  Name = "Argument1",
const int  Position = 1,
const std::string  Default = "",
const Flags  flags = (Flags::KeepErr) 
)
virtual

Get the value of the object from an SDS structure or file.

This method will access an Sds structure which may be specified either directly as the argument to an action or as the name of an SDS file containing the structure.

If the argument id is non-zero, points to an Sds structured item and the structure name is not "ArgStructure", then the id of this structure is returned.

If the argument system id is non-zero and points to the an SDS item named "ArgStructure", the we try to find (by name or position), the requested item. If such an item is found and it is a Sds structure, the id of the item is returned.
Otherwise, we interpret the value of the item as a filename and try to read the file. If the succeeds, then we return the id of the structure read from the file use SdsRead().

If we still don't have a value, the flag KeepErr is NOT specified and Default has a non-zero length, then it is treated as the name of a file which we read using SdsRead(). The resulting Sds id is returned.

If we read the value from a file, the name of the file is returned available from ActualName(). Otherwise, the name of the structure is returned by ActualName().

Methods WasReadFromFile() and WasReadFromDefault() indicate how we got the value.

Note
- if we did not read this item from a file, then it is likely that the underlying SDS structure will be destroyed when the source of parameter Id is destroyed. Copy the item (sds::Id::Copy()) if you need it to last longer.
The DRAMA lock must be taken when executing this. If in a thread, the preference is to take it by constructing a drama::AccessDrama object to ensure the action context is correct.
Parameters
IdThe SDS Argument structure.
NameThe name of the argument to get.
PositionIf the item does not exist by the name, then presume this position.
DefaultThe default file name value. If we can't find the item and this item is not a zero length string, then it is a file we will use to read the default value from. Only used if the KeepErr flag is NOT yet and no exception thrown.
flagsWhich GIT Flags to apply

Referenced by Id(), and Id().