libCZI
Reading and Writing CZI documents made easy
libCZI::CDimCoordinate Class Reference

Implementation of a class representing a coordinate (and implementing the IDimCoordinate-interface). More...

#include <libCZI_DimCoordinate.h>

Inheritance diagram for libCZI::CDimCoordinate:
libCZI::CDimBase libCZI::IDimCoordinate

Public Member Functions

 CDimCoordinate ()
 Default constructor which constructs an empty coordinate (no valid dimensions).
 
 CDimCoordinate (std::initializer_list< DimensionAndValue > list)
 
 CDimCoordinate (const libCZI::IDimCoordinate *other)
 
void Set (libCZI::DimensionIndex dimension, int value)
 
void Clear (libCZI::DimensionIndex dimension)
 
void Clear ()
 Clears the validity of all dimensions.
 
void EnumValidDimensions (const std::function< bool(libCZI::DimensionIndex dim, int value)> &func) const
 
int GetValidDimensionsCount () const
 Determine the number the valid dimensions contained in this coordinate.
 
bool TryGetPosition (libCZI::DimensionIndex dim, int *coordinate) const override
 
- Public Member Functions inherited from libCZI::IDimCoordinate
bool IsValid (DimensionIndex dim) const
 
int GetNumberOfValidDimensions () const
 

Static Public Member Functions

static CDimCoordinate Parse (const char *str)
 

Additional Inherited Members

- Static Protected Member Functions inherited from libCZI::CDimBase
static std::underlying_type< libCZI::DimensionIndex >::type GetBitIndexForDimension (libCZI::DimensionIndex dim)
 

Detailed Description

Implementation of a class representing a coordinate (and implementing the IDimCoordinate-interface).

Constructor & Destructor Documentation

◆ CDimCoordinate() [1/2]

libCZI::CDimCoordinate::CDimCoordinate ( std::initializer_list< DimensionAndValue list)
inline

Constructor which constructs a coordinate object from the specified initializer list. It can be used like this:

CDimCoordinate()
Default constructor which constructs an empty coordinate (no valid dimensions).
Definition: libCZI_DimCoordinate.h:155
@ C
The C-dimension ("channel").
@ Z
The Z-dimension.
@ T
The T-dimension ("time").
Remarks
If the same dimension appears multiple times in the initializer list, then the last occurence wins.
Parameters
listThe list of dimensions-and-values.

◆ CDimCoordinate() [2/2]

libCZI::CDimCoordinate::CDimCoordinate ( const libCZI::IDimCoordinate other)
inlineexplicit

Copy-constructor which creates a copy of the specifed coordinate.

Parameters
otherThe coordinate for which to create a copy. It may be null in which case an empty coordinate is created.

Member Function Documentation

◆ Clear()

void libCZI::CDimCoordinate::Clear ( libCZI::DimensionIndex  dimension)
inline

Clears the validity of the specified dimension.

Parameters
dimensionThe dimension to mark as 'not valid for this coordinate'.

◆ EnumValidDimensions()

void libCZI::CDimCoordinate::EnumValidDimensions ( const std::function< bool(libCZI::DimensionIndex dim, int value)> &  func) const
inline

Enumerate the valid dimensions contained in this coordinate. The specified functor will be called for each valid dimension (and providing the functor with the dimension index and the coordinate). If the functor returns false, the enumeration is cancelled.

Parameters
funcThe functor to call for each valid dimension. If returning false, the enumeration is cancelled.

◆ Parse()

static CDimCoordinate libCZI::CDimCoordinate::Parse ( const char *  str)
static

Parse the specified string and construct a CDimCoordinate-object from the information. The syntax for the string is - a character identifying the dimension (one of 'Z', 'C', 'T', 'R', 'S', 'I', 'H', 'V', 'B') followed by an integer (possibly with a + or -). There can be more than one dimension given, in which case the parts can be separated by a comma, a semicolon or spaces. The regular expression is:

([:blank:]*[Z|C|T|R|S|I|H|V|B][\\+|-]?[[:digit:]]+[,|;| ]*)

It is illegal to give the same dimension multiple times.

Exceptions
LibCZIStringParseExceptionThrown when the specified string cannot be parsed because of a syntactical error.
Parameters
strThe string to parse.
Returns
A CDimCoordinate object constructed from the string.

◆ Set()

void libCZI::CDimCoordinate::Set ( libCZI::DimensionIndex  dimension,
int  value 
)
inline

Sets the value for the specified dimension. The specified dimension will be marked 'valid'.

Parameters
dimensionThe dimension to set.
valueThe value to set.

◆ TryGetPosition()

bool libCZI::CDimCoordinate::TryGetPosition ( libCZI::DimensionIndex  dim,
int *  coordinate 
) const
inlineoverridevirtual

Attempts to get position index in the specified dimension.

Parameters
dimThe dimension.
[out]coordinateIf non-null and the dimension is valid (in this coordinate), it will receive the value of the coordinate for the specified dimension.
Returns
True if it succeeds (i. e. the specified dimension is given in this coordinate), false otherwise.

Implements libCZI::IDimCoordinate.


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