diguyVariable

Generated from diguyVariable.h

DI-Guy API Version 12.5.1

This file was automatically generated from diguyVariable.h. Do not edit this file directly; the changes will be lost.
Includes: diguy_constants.h | diguy_typedefs.h | declspec_diguy.h

Contents:

Alphabetical Index

Link against: libdiguy

class diguyVariable

class BDI_DECLSPEC_diguy diguyVariable
{
public:
    const char* get_name();
    int set_name(const char* name);
    const char* get_type_name();
    diguyScenario* get_scenario();
    diguyCharacter* get_character();
    int copy(diguyVariable* rhs);
    int get_value_as_int();
    float get_value_as_float();
    const char* get_value_as_string();
    int set_value_as_int(int value);
    int set_value_as_float(float value);
    int set_value_as_string(const char* value);
    int increment_value_as_int(int increment_amount = 1);
    int decrement_value_as_int(int decrement_amount = 1);
    int equal_to_int(int value);
    int greater_than_int(int value);
    int less_than_int(int value);
    int equal_to_float(float value);
    int greater_than_float(float value);
    int less_than_float(float value);
    int equal_to_string(const char* value);
    int greater_than_string(const char* value);
    int less_than_string(const char* value);
    int get_initial_value_as_int();
    float get_initial_value_as_float();
    const char* get_initial_value_as_string();
    int set_initial_value_as_int(int initial_value);
    int set_initial_value_as_float(float initial_value);
    int set_initial_value_as_string(const char* initial_value);
    enum {
        CALLBACK_ID_VALUE_CHANGED = 1
    };
#ifdef CPLUSPLUS_ONLY
    int add_callback(int callback_id,
        diguyVariableCallback* callback,
        void* callback_params = 0,
        void* callback_user_data = 0);
    int remove_callback(int callback_id,
        diguyVariableCallback* callback);
    int remove_callback_with_user_data(int callback_id,
        void* callback_user_data);
    int add_callback_script(int callback_id,
        const char* callback_script,
        const char* callback_script_type = NULL);
    int remove_callback_script(int callback_id,
        const char* callback_script,
        const char* callback_script_type = NULL);
    int map_event_handler_to_callback_id(int callback_id,
        const char* handler_name);
    int unmap_event_handler_from_callback_id(int callback_id,
        const char* handler_name,
        int unmap_all_matches = 0);

function diguyVariable::get_name

Prototype:

const char* get_name();
Description:

Returns the name of the variable. This pointer will never be NULL.

Returns:

name of the variable

Callable From:

function diguyVariable::set_name

Prototype:

int set_name(const char* name);
Description:

This function sets the name of this object.

Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::get_type_name

Prototype:

const char* get_type_name();
Description:

Returns the type name of the object. This pointer will never be NULL.

Returns:

type name of the object

Callable From:

function diguyVariable::get_scenario

Prototype:

diguyScenario* get_scenario();
Description:

Returns the scenario that this variable belongs to. This pointer will never be NULL. Note that if this variable belongs to a character, a pointer to the scenario that the character belongs to will be returned.

Returns:

pointer of type diguyScenario

Callable From:

function diguyVariable::get_character

Prototype:

diguyCharacter* get_character();
Description:

Returns the character that this variable belongs to, if any. This pointer might be NULL is this variable is not a character variable.

Returns:

pointer of type diguyCharacter; NULL if this variable is not a character variable

Callable From:

function diguyVariable::copy

Prototype:

int copy(diguyVariable* rhs);
Description:

Copies the contents of the passed variable.

Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::get_value_as_int

Prototype:

int get_value_as_int();
Description:

Returns the value of the variable as an integer.

Returns:

value of the variable

Callable From:

function diguyVariable::get_value_as_float

Prototype:

float get_value_as_float();
Description:

Returns the value of the variable as a floating point number.

Returns:

value of the variable

Callable From:

function diguyVariable::get_value_as_string

Prototype:

const char* get_value_as_string();
Description:

Returns the value of the variable as a string. This pointer will never be NULL.

Returns:

value of the variable

Callable From:

function diguyVariable::set_value_as_int

Prototype:

int set_value_as_int(int value);
Description:

This function sets the value as an integer.

Arguments:

valuenew value of variable
Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::set_value_as_float

Prototype:

int set_value_as_float(float value);
Description:

This function sets the value as a floating point number.

Arguments:

valuenew value of variable
Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::set_value_as_string

Prototype:

int set_value_as_string(const char* value);
Description:

This function sets the value as a string.

Arguments:

valuenew value of variable
Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::increment_value_as_int

Prototype:

int increment_value_as_int(int increment_amount = 1);
Description:

This function increments the value as an int.

Arguments:

increment_amountthe value by which to increment
Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::decrement_value_as_int

Prototype:

int decrement_value_as_int(int decrement_amount = 1);
Description:

This function decrements the value as an int.

Arguments:

decrement_amountthe value by which to decrement
Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::equal_to_int

Prototype:

int equal_to_int(int value);
Returns:

1 if the variable as an int is equal to the passed value; 0 if not

Arguments:

valuethe value to compare against
Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::greater_than_int

Prototype:

int greater_than_int(int value);
Returns:

1 if the variable as an int is greater than the passed value; 0 if not

Arguments:

valuethe value to compare against
Callable From:

function diguyVariable::less_than_int

Prototype:

int less_than_int(int value);
Returns:

1 if the variable as an int is less than the passed value; 0 if not

Arguments:

valuethe value to compare against
Callable From:

function diguyVariable::equal_to_float

Prototype:

int equal_to_float(float value);
Returns:

1 if the variable as a float is equal to the passed value; 0 if not

Arguments:

valuethe value to compare against
Callable From:

function diguyVariable::greater_than_float

Prototype:

int greater_than_float(float value);
Returns:

1 if the variable as a float is greater than the passed value; 0 if not

Arguments:

valuethe value to compare against
Callable From:

function diguyVariable::less_than_float

Prototype:

int less_than_float(float value);
Returns:

1 if the variable as a float is less than the passed value; 0 if not

Arguments:

valuethe value to compare against
Callable From:

function diguyVariable::equal_to_string

Prototype:

int equal_to_string(const char* value);
Returns:

1 if the variable as a string is equal to the passed value; 0 if not

Arguments:

valuethe value to compare against
Callable From:

function diguyVariable::greater_than_string

Prototype:

int greater_than_string(const char* value);
Returns:

1 if the variable as a string is alphabetically greater than the passed value; 0 if not

Arguments:

valuethe value to compare against
Callable From:

function diguyVariable::less_than_string

Prototype:

int less_than_string(const char* value);
Returns:

1 if the variable as a string is alphabetically less than the passed value; 0 if not

Arguments:

valuethe value to compare against
Callable From:

function diguyVariable::get_initial_value_as_int

Prototype:

int get_initial_value_as_int();
Description:

Returns the initial value of the variable as an integer.

Returns:

initial value of the variable

Callable From:

function diguyVariable::get_initial_value_as_float

Prototype:

float get_initial_value_as_float();
Description:

Returns the initial value of the variable as a floating point number.

Returns:

initial value of the variable

Callable From:

function diguyVariable::get_initial_value_as_string

Prototype:

const char* get_initial_value_as_string();
Description:

Returns the initial value of the variable as a string. This pointer will never be NULL.

Returns:

initial value of the variable

Callable From:

function diguyVariable::set_initial_value_as_int

Prototype:

int set_initial_value_as_int(int initial_value);
Description:

This function sets the initial value as an integer. The current value will be set to the initial value when the scenario containing this variable is reset.

Arguments:

initial valuenew initial value of variable
Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::set_initial_value_as_float

Prototype:

int set_initial_value_as_float(float initial_value);
Description:

This function sets the initial value as a floating point number. The current value will be set to the initial value when the scenario containing this variable is reset.

Arguments:

initial valuenew initial value of variable
Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::set_initial_value_as_string

Prototype:

int set_initial_value_as_string(const char* initial_value);
Description:

This function sets the initial value as a string. The current value will be set to the initial value when the scenario containing this variable is reset.

Arguments:

initial valuenew initial value of variable
Returns:

0 on success, -1 on failure

Callable From:

Callback Functions

enumeration

	enum {
		CALLBACK_ID_VALUE_CHANGED = 1
	};
Description:

This is an enumeration of the different callbacks that can be registered with add_callback() and add_callback_script().

Usable From:

function diguyVariable::add_callback

Prototype:

int add_callback(int callback_id,
    diguyVariableCallback* callback,
    void* callback_params = 0,
    void* callback_user_data = 0);
Description:

This function adds a user callback.

Arguments:

callback pointer to function with prototype diguyVariableCallback (typedefed above)
callback_id integer id of when this callback is to be called
callback_paramsnot currently used; pass NULL
callback_user_datapointer for user's own use; DI-Guy will do nothing to the contents of this pointer beyond passing it back when the callback is invoked
callback_id should be one of the following values:

CALLBACK_ID_VALUE_CHANGED

This callback will be called whenever the value of the variable changes.

There are no parameters for this callback.

Callback Return Values:

Callbacks return a value of type diguyCallbackReturn, which will be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE. If the callback returns DIGUY_CALLBACK_STOP, the default handler of the function will not be called; the callback is asserting that it has done everything necessary for the function call. If the callback returns DIGUY_CALLBACK_CONTINUE, the default handler for the function will be called after the callback.

Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::remove_callback

Prototype:

int remove_callback(int callback_id,
    diguyVariableCallback* callback);
Description:

This function removes a user callback. All callbacks matching the specified callback_id and callback function will be removed.

Arguments:

callback_id integer id of when this callback is to be called
callback pointer to function with prototype diguyVariableCallback (typedefed above)
Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::remove_callback_with_user_data

Prototype:

int remove_callback_with_user_data(int callback_id,
    void* callback_user_data);
Description:

This function removes a user callback. All callbacks matching the specified callback_id and callback_user_data pointer will be removed.

Arguments:

callback_id integer id of when this callback is to be called
callback_user_datapointer for user's own use
Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::add_callback_script

Prototype:

int add_callback_script(int callback_id,
    const char* callback_script,
    const char* callback_script_type = NULL);
Description:

This function adds a user callback script. Callback scripts can be removed with remove_callback_script().

See diguyCharacter::add_callback_script() for an example of use.

Arguments:

callback_id integer id of the callback
callback_script script text of callback to be added
callback_script_typethe type of script contained in callback_script
If NULL is passed for callback_script_type, a default script type will be derived based on the default script interpreter of the scenario.

Lua specific:

When the script is called, the object for which it is being called will be in the callback_object global.

To pass NULL when calling from a lua script, use nil.

Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::remove_callback_script

Prototype:

int remove_callback_script(int callback_id,
    const char* callback_script,
    const char* callback_script_type = NULL);
Description:

This function removes a user callback script previously added with add_callback_script().

See diguyCharacter::remove_callback_script() for an example of use.

Arguments:

callback_id integer id of the callback
callback_script script text of callback previously added
callback_script_typethe type of script contained in callback_script
If NULL is passed for callback_script, all callback scripts whose ids match callback_id and whose types match callback_script_type will be removed.

If NULL is passed for callback_script_type, a default script type will be derived based on the default script interpreter of the scenario.

Lua specific:

To pass NULL when calling from a lua script, use nil.

Returns:

0 on success, -1 on failure

Callable From:

Event Handler Functions

function diguyVariable::map_event_handler_to_callback_id

Prototype:

int map_event_handler_to_callback_id(int callback_id,
    const char* handler_name);
Description:

This function maps the event handler with the given name to a callback id. This mapping will be saved in the .dss file and restored when the .dss file is loaded.

Mappings can also be made via the DI-Guy Scenario UI.

The event handler is one of the following:

Arguments:

callback_id integer id of callback
handler_name name of the event handler to map
Returns:

0 on success, -1 on failure

Callable From:

function diguyVariable::unmap_event_handler_from_callback_id

Prototype:

int unmap_event_handler_from_callback_id(int callback_id,
    const char* handler_name,
    int unmap_all_matches = 0);
Description:

This function unmaps the event handler with the given name from a callback id.

Arguments:

callback_id integer id of callback
handler_name name of the event handler to map
unmap_all_matches pass 0 to unmap only the first match, pass 1 to unmap all matches
Returns:

0 on success, -1 on failure

Callable From:


Alphabetical Index




Copyright (C) 1992-2012 Boston Dynamics

ALL RIGHTS RESERVED.

These coded instructions, statements, and computer programs contain unpublished proprietary information of Boston Dynamics and are protected by Copyright Laws of the United States. They may not be used, duplicated, or disclosed in any form, in whole or in part, without the prior written consent from Boston Dynamics.

RESTRICTED RIGHTS LEGEND

Use, duplication, or disclosure by the government is subject to restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Sofware clause at DFARS 252.227-7013 and/or in similar or successor clauses in the FAR, or the DOD or NASA FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the Commercial Computer Software--Restricted Rights at 48 CFR 52.227-19, as applicable. Unpublished-rights reserved under the Copyright Laws of the United States.

Contractor/Manufacturer is:

Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.