Argument Class Reference
 
 
 
Argument Class Reference

#include <xsi_argument.h>


Class Description

The Argument object represents an argument (or parameter) of a Softimage Command. For example, the DeleteObj command takes 1 argument (InputObj).

Argument objects are used in three circumstances in Softimage:

For defining command arguments at creation time
When a command is created, arguments are added to the Command object using ArgumentArray::Add, ArgumentArray::AddWithHandler or ArgumentArray::AddObjectArgument. The value of the argument (see Argument::PutValue) is treated as the default value for that argument. This default value is persisted and is used as the argument value in the case that no value is specified at invocation time.
For specifying argument values when invoking a command.
When a command is invoked, Argument::PutValue is used to specify the value of the argument that will be passed to the command. Or, when not specifically set the value will be determined based on the default or the ArgumentHandler associated with the argument. From the C++ API the most common way of invoking a command is with Application::ExecuteCommand, in which case it is not necessary to deal with this object at all.
For re-defining command arguments after installation
It is also possible to change the definition of a custom command after it has been installed. In this case Argument::PutValue is used to specify new default values for the command, and it is possible to add and remove arguments. Then Command::Update is called to commit the changes. (This case does not apply to custom commands implemented inside a self-installed plug-in).

For more information and an example see the documentation for the Command object.

Since:
4.0
Inheritance diagram for Argument:
SIObject CBase

List of all members.

Public Member Functions

  Argument ()
  ~Argument ()
  Argument (const CRef &in_ref)
  Argument (const Argument &in_obj)
bool  IsA (siClassID in_ClassID) const
siClassID  GetClassID () const
Argument operator= (const Argument &in_obj)
Argument operator= (const CRef &in_ref)
CValue  GetValue () const
CStatus  PutValue (const CValue &)
siArgumentFlags  GetFlags () const
ArgumentHandler  GetHandler () const
CStatus  PutHandler (const CString &in_strHandler)
CStatus  PutHandler (ArgumentHandler &in_Handler)

Constructor & Destructor Documentation

Argument ( )

Default constructor.

~Argument ( )

Default destructor.

Argument ( const CRef in_ref )

Constructor.

Parameters:
in_ref constant reference object.
Argument ( const Argument in_obj )

Copy constructor.

Parameters:
in_obj constant class object.

Member Function Documentation

bool IsA ( siClassID  in_ClassID ) const [virtual]

Returns true if a given class type is compatible with this API class.

Parameters:
in_ClassID class type.
Returns:
true if the class is compatible, false otherwise.

Reimplemented from SIObject.

siClassID GetClassID ( ) const [virtual]

Returns the type of the API class.

Returns:
The class type.

Reimplemented from SIObject.

Argument& operator= ( const Argument in_obj )

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:
in_obj constant class object.
Returns:
The new Argument object.
Argument& operator= ( const CRef in_ref )

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:
in_ref constant class object.
Returns:
The new Argument object.

Reimplemented from SIObject.

CValue GetValue ( ) const

Returns the value of the argument. This would be the default value from the command definition unless some alternative value has been set by calling Argument::PutValue.

Returns:
The value of the argument.
Since:
4.0
CStatus PutValue ( const CValue )

Sets the value of an argument. If called while the command is being defined, (for example in the commandname_Init callback of a self-installed plug-in) then this establishes the default value of the argument which is persisted as part of the command definition.

When you use Command::Execute to invoke a command, you can provide an actual value for this argument, which overrides the default value, but does not affect the persisted command definition.

Warning:
The Value is erased if Argument::PutHandler is called to set an ArgumentHandler after the Value has been already set.
Returns:
CStatus::OK
CStatus::Fail
See also:
ArgumentArray::Add
Since:
4.0
siArgumentFlags GetFlags ( ) const

Returns the argument flags. These flags indicate how the argument values are passed to or from the Command. Arguments for custom commands always use siArgumentInput.

Returns:
The the argument flags (one of the siArgumentFlags values).
Since:
4.0
ArgumentHandler GetHandler ( ) const

Returns the ArgumentHandler, if any, of the Argument. Call ArgumentHandler::IsValid on the returned object to test whether there really is an ArgumentHandler.

Note:
This function should not be confused with Command::GetHandler, which returns the name of a script function.
Returns:
The new ArgumentHandler object.
Since:
4.0
CStatus PutHandler ( const CString in_strHandler )

Sets the ArgumentHandler of the argument based on the desired type.

Warning:
Calling this function flushes any existing value associated with the Argument (see Argument::PutValue).
Parameters:
in_strHandler String from the ::siArgumentHandler enum, for example Frame, SingleObj or Collection.
Returns:
CStatus::OK
CStatus::Fail
See also:
ArgumentArray::AddWithHandler
Since:
4.0
CStatus PutHandler ( ArgumentHandler in_Handler )

Sets the ArgumentHandler of the argument by using an existing ArgumentHandler object.

Parameters:
in_Handler An instance of an ArgumentHandler. Pass an uninitialized ArgumentHandler object to remove any existing ArgumentHandler.
Returns:
CStatus::OK
CStatus::Fail
See also:
ArgumentArray::AddWithHandler
Since:
4.0

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