Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLJsonElement Class Reference

Represents a json object or list. More...

#include <Libs/MRML/Core/vtkMRMLJsonElement.h>

Inheritance diagram for vtkMRMLJsonElement:
Collaboration diagram for vtkMRMLJsonElement:

Public Types

typedef vtkObject Superclass
 
enum  Type {
  UNKNOWN = 0 , OBJECT = 1 , ARRAY = 2 , STRING = 3 ,
  BOOL = 4 , INT = 5 , DOUBLE = 6
}
 

Public Member Functions

VTK_NEWINSTANCE vtkMRMLJsonElementGetArrayItem (int childItemIndex)
 
bool GetArrayItemsStringProperty (const char *arrayName, const char *propertyName, std::vector< std::string > &propertyValues)
 
VTK_NEWINSTANCE vtkMRMLJsonElementGetArrayProperty (const char *arrayName)
 
int GetArraySize ()
 Returns the number of elements in this array.
 
bool GetBoolProperty (const char *propertyName)
 Get Boolean property value.
 
bool GetBoolProperty (const char *propertyName, bool &propertyValue)
 
VTK_NEWINSTANCE vtkMRMLJsonElementGetChildMemberItem (int childItemIndex)
 
virtual const char * GetClassName ()
 
VTK_NEWINSTANCE vtkCodedEntryGetCodedEntryProperty (const char *propertyName)
 
VTK_NEWINSTANCE vtkDoubleArray * GetDoubleArrayProperty (const char *propertyName)
 
double GetDoubleProperty (const char *propertyName)
 
bool GetDoubleProperty (const char *propertyName, double &propertyValue)
 
int GetIntProperty (const char *propertyName)
 
bool GetIntProperty (const char *propertyName, int &propertyValue)
 
bool GetMatrix4x4Property (const char *propertyName, double v[16], bool flipRasLps)
 
Type GetMemberType (const char *propertyName)
 
VTK_NEWINSTANCE vtkMRMLJsonElementGetObjectItem (int childItemIndex)
 
VTK_NEWINSTANCE vtkMRMLJsonElementGetObjectProperty (const char *objectName)
 
std::string GetObjectPropertyNameByIndex (int childItemIndex)
 Get object member name by index.
 
int GetObjectSize ()
 Returns the number of elements in this object.
 
std::string GetSchema ()
 Get the JSON schema name.
 
std::string GetStringProperty (const char *propertyName)
 
bool GetStringProperty (const char *propertyName, std::string &propertyValue)
 
bool GetStringVectorProperty (const char *propertyName, std::vector< std::string > &arrayValues)
 
Type GetType ()
 Returns this element type.
 
virtual vtkMRMLMessageCollectionGetUserMessages ()
 Returns user-displayable messages that may contain details about any failed operation.
 
bool GetVectorProperty (const char *propertyName, double *v, int numberOfComponents=3)
 
bool HasErrors ()
 Returns true if user messages contain error messages.
 
bool HasMember (const char *propertyName)
 Returns true if the JSON object contains a member by this name.
 
virtual int IsA (const char *type)
 
bool IsArray ()
 Returns true if this element is an array.
 
bool IsObject ()
 Returns true if this element is an object.
 
void PrintSelf (ostream &os, vtkIndent indent) override
 

Static Public Member Functions

static int IsTypeOf (const char *type)
 
static vtkMRMLJsonElementNew ()
 
static vtkMRMLJsonElementSafeDownCast (vtkObject *o)
 

Static Public Attributes

static const std::string XML_NAME_VALUE_SEPARATOR
 
static const std::string XML_SEPARATOR
 

Protected Member Functions

void operator= (const vtkMRMLJsonElement &)
 
 vtkMRMLJsonElement ()
 
 vtkMRMLJsonElement (const vtkMRMLJsonElement &)
 
 ~vtkMRMLJsonElement () override
 

Protected Attributes

vtkInternalInternal
 
vtkNew< vtkMRMLMessageCollectionUserMessages
 

Friends

class vtkInternal
 
class vtkMRMLJsonReader
 

Detailed Description

Represents a json object or list.

Definition at line 32 of file vtkMRMLJsonElement.h.

Member Typedef Documentation

◆ Superclass

typedef vtkObject vtkMRMLJsonElement::Superclass

Definition at line 36 of file vtkMRMLJsonElement.h.

Member Enumeration Documentation

◆ Type

Enumerator
UNKNOWN 
OBJECT 
ARRAY 
STRING 
BOOL 
INT 
DOUBLE 

Definition at line 49 of file vtkMRMLJsonElement.h.

Constructor & Destructor Documentation

◆ vtkMRMLJsonElement() [1/2]

vtkMRMLJsonElement::vtkMRMLJsonElement ( )
protected

◆ ~vtkMRMLJsonElement()

vtkMRMLJsonElement::~vtkMRMLJsonElement ( )
overrideprotected

◆ vtkMRMLJsonElement() [2/2]

vtkMRMLJsonElement::vtkMRMLJsonElement ( const vtkMRMLJsonElement & )
protected

Member Function Documentation

◆ GetArrayItem()

VTK_NEWINSTANCE vtkMRMLJsonElement * vtkMRMLJsonElement::GetArrayItem ( int childItemIndex)

Returns the n-th object elements in this array. Only in C++: The caller must take ownership of the returned object.

◆ GetArrayItemsStringProperty()

bool vtkMRMLJsonElement::GetArrayItemsStringProperty ( const char * arrayName,
const char * propertyName,
std::vector< std::string > & propertyValues )

Get property values from each item of an array. If no such property is found or it is not the right type then false is returned.

◆ GetArrayProperty()

VTK_NEWINSTANCE vtkMRMLJsonElement * vtkMRMLJsonElement::GetArrayProperty ( const char * arrayName)

Get an array element from a property. If no such property is found or it is not the right type then nullptr is returned. Only in C++: The caller must take ownership of the returned object.

◆ GetArraySize()

int vtkMRMLJsonElement::GetArraySize ( )

Returns the number of elements in this array.

◆ GetBoolProperty() [1/2]

bool vtkMRMLJsonElement::GetBoolProperty ( const char * propertyName)

Get Boolean property value.

◆ GetBoolProperty() [2/2]

bool vtkMRMLJsonElement::GetBoolProperty ( const char * propertyName,
bool & propertyValue )

Get Boolean property value. If a Boolean property by the specified name is found then set it in propertyValue and return true. If a Boolean property by the specified name is not found then return false.

◆ GetChildMemberItem()

VTK_NEWINSTANCE vtkMRMLJsonElement * vtkMRMLJsonElement::GetChildMemberItem ( int childItemIndex)

Similar to GetObjectItem, but it returns the n-th elements for any type. Only in C++: The caller must take ownership of the returned object.

◆ GetClassName()

virtual const char * vtkMRMLJsonElement::GetClassName ( )
virtual

Reimplemented in vtkMRMLMarkupsJsonElement.

◆ GetCodedEntryProperty()

VTK_NEWINSTANCE vtkCodedEntry * vtkMRMLJsonElement::GetCodedEntryProperty ( const char * propertyName)

Get a coded entry object from a property. If no such property is found or it is not the right type then nullptr is returned. Only in C++: The caller must take ownership of the returned object.

◆ GetDoubleArrayProperty()

VTK_NEWINSTANCE vtkDoubleArray * vtkMRMLJsonElement::GetDoubleArrayProperty ( const char * propertyName)

Get a variable-size, potentially multi-component floating-point vector from a property. If no such property is found or it is not the right type then nullptr is returned. Only in C++: The caller must take ownership of the returned object.

◆ GetDoubleProperty() [1/2]

double vtkMRMLJsonElement::GetDoubleProperty ( const char * propertyName)

Get double-precision floating point property value. If no such property is found or it is not double then 0.0 is returned.

◆ GetDoubleProperty() [2/2]

bool vtkMRMLJsonElement::GetDoubleProperty ( const char * propertyName,
double & propertyValue )

Get double-precision floating point property value. If a double property by the specified name is found then set it in propertyValue and return true. If a double property by the specified name is not found then return false.

◆ GetIntProperty() [1/2]

int vtkMRMLJsonElement::GetIntProperty ( const char * propertyName)

Get integer property value. If no such property is found or it is not integer then 0 is returned.

◆ GetIntProperty() [2/2]

bool vtkMRMLJsonElement::GetIntProperty ( const char * propertyName,
int & propertyValue )

Get integer property value. If an integer property by the specified name is found then set it in propertyValue and return true. If an integer double property by the specified name is not found then return false.

◆ GetMatrix4x4Property()

bool vtkMRMLJsonElement::GetMatrix4x4Property ( const char * propertyName,
double v[16],
bool flipRasLps )

Get 4x4 matrix from a property. If no such property is found or it is not the right type then false is returned. If flipRasLps is set to true then the matrix is converted between LPS/RAS coordinate system (multiplied by diag(-1,-1,1,1) matrix).

◆ GetMemberType()

Type vtkMRMLJsonElement::GetMemberType ( const char * propertyName)

◆ GetObjectItem()

VTK_NEWINSTANCE vtkMRMLJsonElement * vtkMRMLJsonElement::GetObjectItem ( int childItemIndex)

Returns the n-th elements in this object as object. Only in C++: The caller must take ownership of the returned object.

◆ GetObjectProperty()

VTK_NEWINSTANCE vtkMRMLJsonElement * vtkMRMLJsonElement::GetObjectProperty ( const char * objectName)

Get an object element from a property. If no such property is found or it is not the right type then nullptr is returned. Only in C++: The caller must take ownership of the returned object.

◆ GetObjectPropertyNameByIndex()

std::string vtkMRMLJsonElement::GetObjectPropertyNameByIndex ( int childItemIndex)

Get object member name by index.

◆ GetObjectSize()

int vtkMRMLJsonElement::GetObjectSize ( )

Returns the number of elements in this object.

◆ GetSchema()

std::string vtkMRMLJsonElement::GetSchema ( )

Get the JSON schema name.

◆ GetStringProperty() [1/2]

std::string vtkMRMLJsonElement::GetStringProperty ( const char * propertyName)

Get string property value. Returns empty string if no such string property is found.

◆ GetStringProperty() [2/2]

bool vtkMRMLJsonElement::GetStringProperty ( const char * propertyName,
std::string & propertyValue )

Get string property value. If a string property by the specified name is found then set it in propertyValue and return true. If a string property by the specified name is not found then return false.

◆ GetStringVectorProperty()

bool vtkMRMLJsonElement::GetStringVectorProperty ( const char * propertyName,
std::vector< std::string > & arrayValues )

Get a vector of string values from a property. If no such property is found or it is not the right type then false is returned.

◆ GetType()

Type vtkMRMLJsonElement::GetType ( )

Returns this element type.

◆ GetUserMessages()

virtual vtkMRMLMessageCollection * vtkMRMLJsonElement::GetUserMessages ( )
virtual

Returns user-displayable messages that may contain details about any failed operation.

◆ GetVectorProperty()

bool vtkMRMLJsonElement::GetVectorProperty ( const char * propertyName,
double * v,
int numberOfComponents = 3 )

Get a fixed-size vector of floating point values from a property. If no such property is found or it is not the right type then false is returned.

◆ HasErrors()

bool vtkMRMLJsonElement::HasErrors ( )

Returns true if user messages contain error messages.

◆ HasMember()

bool vtkMRMLJsonElement::HasMember ( const char * propertyName)

Returns true if the JSON object contains a member by this name.

◆ IsA()

virtual int vtkMRMLJsonElement::IsA ( const char * type)
virtual

Reimplemented in vtkMRMLMarkupsJsonElement.

◆ IsArray()

bool vtkMRMLJsonElement::IsArray ( )

Returns true if this element is an array.

◆ IsObject()

bool vtkMRMLJsonElement::IsObject ( )

Returns true if this element is an object.

◆ IsTypeOf()

static int vtkMRMLJsonElement::IsTypeOf ( const char * type)
static

◆ New()

static vtkMRMLJsonElement * vtkMRMLJsonElement::New ( )
static

◆ operator=()

void vtkMRMLJsonElement::operator= ( const vtkMRMLJsonElement & )
protected

◆ PrintSelf()

void vtkMRMLJsonElement::PrintSelf ( ostream & os,
vtkIndent indent )
override

◆ SafeDownCast()

static vtkMRMLJsonElement * vtkMRMLJsonElement::SafeDownCast ( vtkObject * o)
static

Friends And Related Symbol Documentation

◆ vtkInternal

friend class vtkInternal
friend

Definition at line 185 of file vtkMRMLJsonElement.h.

◆ vtkMRMLJsonReader

friend class vtkMRMLJsonReader
friend

Definition at line 186 of file vtkMRMLJsonElement.h.

Member Data Documentation

◆ Internal

vtkInternal* vtkMRMLJsonElement::Internal
protected

Definition at line 184 of file vtkMRMLJsonElement.h.

◆ UserMessages

vtkNew<vtkMRMLMessageCollection> vtkMRMLJsonElement::UserMessages
protected

Definition at line 181 of file vtkMRMLJsonElement.h.

◆ XML_NAME_VALUE_SEPARATOR

const std::string vtkMRMLJsonElement::XML_NAME_VALUE_SEPARATOR
static

Definition at line 41 of file vtkMRMLJsonElement.h.

◆ XML_SEPARATOR

const std::string vtkMRMLJsonElement::XML_SEPARATOR
static

Definition at line 40 of file vtkMRMLJsonElement.h.


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