OEInterface

class OEInterface

This class represents OEInterface.

Constructors

OEInterface()
OEInterface(const OEInterface &)

Default and copy constructors.

OEInterface(const unsigned char *dataptr)
OEInterface(const char *dataptr)

Constructs an OEInterface and configures it with the interface definition passed by dataptr. This is equivalent to the following code:

OEInterface itf;

if (!OEConfigure(itf, InterfaceData))
  OEThrow.Fatal("Problem configuring OEInterface!");

Note

It is possible to configure an OEInterface from multiple interface definitions. Just call OEConfigure once per interface definition on the same OEInterface object.

OEInterface(const unsigned char *dataptr, int argc, char **argv)
OEInterface(const char *dataptr, int argc, char **argv)

Constructs an OEInterface and configures it with the interface definition passed by dataptr. Then parses the command line given by argv. This is equivalent to the following code:

OEInterface itf;

if (!OEConfigure(itf, InterfaceData))
  OEThrow.Fatal("Problem configuring OEInterface!");

if (!OEParseCommandLine(itf, argc, argv))
  OEThrow.Fatal("Unable to parse command line");

Warning

These convenience constructors may force the program to exit and thus may not appropriate when writing a library that should instead return errors.

operator=

OEInterface &operator=(const OEInterface &)

AddDetail

bool AddDetail(const std::string &detail)

Adds a line to the detailed description of the OEInterface. Returns true if the add was successful and false otherwise. (The current implementation never fails)

AddInterface

OEInterface *AddInterface()

Adds a child OEInterface and returns a pointer to the newly created object (which is owned by the current OEInterface object).

AddParameter

OEParameter *AddParameter(std::string classid)

Adds a parameter to the OEInterface instance. The returned pointer points to the newly created OEParameter object. This memory is owned by the OEInterface object. If the add fails NULL will be returned.

The implementation of the returned OEParameter pointer will always be a subclass of

template <TT> OETypedParameter

The specific type depends upon the value of classid as follows :

string

TT is std::string parameter

double

TT is double parameter

float

TT is float parameter

bool

TT is bool parameter

int

TT is int parameter

file

TT is oeisstream parameter

param_file

TT is oeisstream and additionally the parameter is specially recognized by OEParseCommandLine as a text file holding parameter settings.

Clear

bool Clear()

Returns the OEInterface object to the default constructed state of an OEInterface.

DeleteInterface

bool DeleteInterface(OEInterface &itf)

Deletes a child OEInterface object. ‘itf’ is the child OEInterface to be deleted. The method returns true if the deletion is successful and false otherwise. ‘itf’ must be directly owned by the OEInterface, not one of its child OEInterfaces.

DeleteParameter

bool DeleteParameter(OEParameter &param)

Deletes a parameter (‘param’) owned by this OEInterface object. The function returns true if the delete succeeds and false otherwise. The parameter must be owned by the OEInterface object to be deleted (it will not delete parameters that belong to child OEInterface objects of this OEInterface).

Factory

OESimpleFactory<std::string, OEParameter> &Factory()

Returns the OEInterface class’s factory used to create new parameters.

Get

template<class TT>
TT Get(std::string name, unsigned int ilist=0) const

Returns the setting (either the value, or default if the value is not set) of the parameter with the given name and instance. The parameter must be of type TT, and must have either have a value or default set. If the parameter cannot be found (i.e., a call to OEInterface::Has with the same TT and ‘name’ returns false) a warning is issued and a default constructed TT is returned.

GetBrief

std::string GetBrief() const

Returns the brief description of the OEInterface object.

GetDetail

OEIterBase<const std::string> *GetDetail() const

Returns the detailed description of the OEInterface object.

GetInterface

OEInterface *GetInterface(std::string name)
const OEInterface *GetInterface(std::string name) const

Returns a pointer to a child OEInterface with a given ‘name’ owned by any child OEInterface. The search is recursive searching through all child’s child OEInterfaces, etc. If no such OEInterface exists NULL is returned.

GetInterfaces

OEIterBase<OEInterface> *GetInterfaces(bool recursive=false)
OEIterBase<const OEInterface> *GetInterfaces(bool recursive=false) const

Returns and iterator over all child OEInterfaces of this object. If recursive is true, the iterator will include all of the children’s OEInterfaces recursively in arbitrary order. If recursive is false only the immediate child OEInterfaces will be returned, and they will be sorted by OEInterface::GetOrderPriority (lowest values first) and then name.

GetList

template<class TT>
OEIterBase<const TT> *GetList(std::string name) const

See also

GetName

std::string GetName() const

Returns the name of the OEInterface object.

GetOrderPriority

int GetOrderPriority() const

Returns the order priority of the OEInterface object.

GetParameter

OEParameter *GetParameter(std::string name)
const OEParameter *GetParameter(std::string name) const

Returns a pointer to a OEParameter with a given ‘name’ owned by the OEInterface object or one of its child OEInterfaces (or child’s child OEInterface, etc). If no such parameter exists NULL is returned.

GetParameters

OEIterBase<OEParameter> *GetParameters(bool recursive=true)
OEIterBase<const OEParameter> *GetParameters(bool recursive=true) const

Returns an iterator over all OEParameters of the OEInterface object. If recursive is true the search is recursive including parameters held by all child OEInterfaces and their children in arbitrary order. If recursive is false parameters held by child OEInterfaces will not be included and they will be sorted by the parameters order priority (lowest values first), followed by name.

GetTypedParameter

template<class TT>
OETypedParameter<TT> *GetTypedParameter(std::string name)
template<class TT>
const OETypedParameter<TT> *GetTypedParameter(std::string name) const

Has

template<class TT>
bool Has(std::string name, unsigned int ilist=0) const

Returns true if all of the following are true:

  1. A parameter with name name is contained by the OEInterface.

  2. The parameter is of type TT

  3. The parameters value of default is set.

In all other cases the function returns false.

Parent

OEInterface *Parent()
const OEInterface *Parent() const

Returns a pointer to the parent OEInterface of this object, or NULL if this OEInterface object does not have a parent.

SetBrief

bool SetBrief(std::string brief)

Sets the brief description of the OEInterface. Returns true if the brief was successfully set and false otherwise. (The current implementation never fails)

SetName

bool SetName(std::string name)

Sets the name of the OEInterface. Returns true if the name was successfully set and false otherwise. (The current implementation never fails).

SetOrderPriority

bool SetOrderPriority(int priority)

Sets the order priority of the OEInterface. The order priority overrides the default sorting by name that is used when calling the GetInterfaces(false) member function. Child OEInterfaces with lower priority values will appear first. This function returns true if the priority was successfully set and false otherwise. (The current implementation never fails).