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

◆ Id() [3/3]

drama::gitarg::Id::Id ( drama::thread::TAction taction,
const sds::Id Id,
const std::string &  Name = "Argument1",
const int  Position = 1,
const std::string  Default = "",
const Flags  flags = Flags::KeepErr 
)
inline

Constructor with the initial value set from an SDS structure or file.

This overload of the constructor should be used from threaded actions, it will lock access to DRAMA while it is fetching the value to ensure ERS messages from the lower level code are recorded against the action correctly.

This constructor 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 if 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.
Parameters
tactionThreaded action pointer
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 set and no exception will be thrown if we don't have the value.
flagsWhich GIT Flags to apply

References drama::CreateRunDramaTask(), drama::Default, and Get().