Demonstration of how to define a variable from a compound type and how to access the components of each variable.
Demonstration of how to define a variable from a compound type and how to access the components of each variable.This is demonstrated with a variable value that is relative to a ValuePool.
#include <ocean/plankton/VModules.hpp>
#include <ocean/plankton/VObject.hpp>
#include <ocean/plankton/VInteractionEvent.hpp>
#include <ocean/plankton/VParameter.hpp>
{
{}
{}
};
int LocalCompoundInput()
{
InteractionOwner->exportMember( &VInteractionEvent::x, "x" );
myInput->activateNotification();
printf("Input has %d components\n", GlobalEventValue->nComponents() );
InteractionOwner->Localize();
printf("Input has %d components\n", EventValue->nComponents() );
if (!EventXValue)
{
puts("No X Value found!");
return 1;
}
{
myInput->setValue( myPool, ActionValue, 0 );
}
{
if (!EventXValue->getValue(
X) )
{
puts("Could not get X value!");
return 2;
}
printf(
"X Values is %d\n",
X);
return 3;
}
EventXValue->setValue(999);
{
if (!EventXValue->getValue(
X) )
{
puts("Could not get X value!");
return 4;
}
printf(
"NEW X Values is %d\n",
X);
return 5;
}
{
myInput->getValue( myPool, ActionValue);
printf(
"Compound Values X is %d\n", ActionValue.
x);
}
{
if (!GlobalEventValue->getValue(ActionValue ) )
{
return 6;
}
printf(
"Global X Values is still %d\n", ActionValue.
x);
}
return 0;
}
A reference counting pointer class which keeps objects alive as long as strong pointers to these obje...
Definition RefPtr.hpp:405
A pointer class which behaves like native C++ pointers, but knows about the lifetime of the reference...
Definition RefPtr.hpp:82
Communication type for mouse and keyboard interactions.
Definition VInteractionEvent.hpp:58
int x
horizontal coordinate of mouse
Definition VInteractionEvent.hpp:60
Shortcut convenience class for VParameters that refer to a VValue<> storage of the actual parameter.
Definition VParameter.hpp:678
List of the components of a compound type.
Definition VValueBase.hpp:35
A node which serves to identify multiple instances of input alternatives for a certain value.
Definition ValueNotifier.hpp:91
A ValuePool is the home of local values of certain input objects.
Definition ValuePool.hpp:58
std::nullptr_t NullPtr
A type indicating an invalid pointer, similar to the NULL pointer in C, but type-safe.
Definition DynPtr.hpp:368
The Vish namespace.
Definition Anemone.cpp:17
Definition OmegaPtrCheck.cpp:14