Tesseract 0.28.4
Loading...
Searching...
No Matches
schema_registration.h File Reference

This is a schema registration class. More...

#include <string>
#include <functional>

Macros

#define TESSERACT_SCHEMA_REG_PASTE(a, b)   a##b
 
#define TESSERACT_SCHEMA_REG_MAKE_NAME(a, b)   TESSERACT_SCHEMA_REG_PASTE(a, b)
 
#define TESSERACT_SCHEMA_REGISTER(KEY, SCHEMA_SOURCE)
 Macro to register either a file‐based schema or a function‐built schema.
 
#define TESSERACT_SCHEMA_REGISTER_DERIVED_TYPE(BASE_TYPE, DERIVED_TYPE)
 Macro to register that a derived type can be used where a base type is expected.
 

Functions

void tesseract::common::registerSchema (const std::string &key, const std::string &path)
 Register a schema from a file path.
 
void tesseract::common::registerSchema (const std::string &key, const std::function< PropertyTree()> &fn)
 Register a schema from a function.
 
void tesseract::common::registerSchemaDerivedType (const std::string &base_type, const std::string &derived_type)
 Register that a derived type schema can be used where a base type is expected.
 

Detailed Description

This is a schema registration class.

Author
Levi Armstrong
Date
March 1, 2026
License
Software License Agreement (Apache License)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Macro Definition Documentation

◆ TESSERACT_SCHEMA_REGISTER

#define TESSERACT_SCHEMA_REGISTER (   KEY,
  SCHEMA_SOURCE 
)
Value:
namespace \
{ \
static const int TESSERACT_SCHEMA_REG_MAKE_NAME(schema_reg_, __COUNTER__) = []() -> int { \
using namespace tesseract::common; \
registerSchema(#KEY, SCHEMA_SOURCE); \
return 0; \
}(); \
}

Macro to register either a file‐based schema or a function‐built schema.

◆ TESSERACT_SCHEMA_REGISTER_DERIVED_TYPE

#define TESSERACT_SCHEMA_REGISTER_DERIVED_TYPE (   BASE_TYPE,
  DERIVED_TYPE 
)
Value:
namespace \
{ \
static const int TESSERACT_SCHEMA_REG_MAKE_NAME(derived_type_reg_, __COUNTER__) = []() -> int { \
using namespace tesseract::common; \
registerSchemaDerivedType(#BASE_TYPE, #DERIVED_TYPE); \
return 0; \
}(); \
}

Macro to register that a derived type can be used where a base type is expected.

Parameters
BASE_TYPEThe base type name
DERIVED_TYPEThe derived type name

Example usage:

TESSERACT_SCHEMA_REGISTER_DERIVED_TYPE(tesseract::planning::BaseConstraint,
tesseract::planning::JointPositionConstraint)
#define TESSERACT_SCHEMA_REGISTER_DERIVED_TYPE(BASE_TYPE, DERIVED_TYPE)
Macro to register that a derived type can be used where a base type is expected.
Definition schema_registration.h:85

Function Documentation

◆ registerSchema() [1/2]

void tesseract::common::registerSchema ( const std::string &  key,
const std::string &  path 
)

Register a schema from a file path.

Parameters
keyUnique identifier for this schema.
pathPath to a .yaml schema file.

◆ registerSchema() [2/2]

void tesseract::common::registerSchema ( const std::string &  key,
const std::function< PropertyTree()> &  fn 
)

Register a schema from a function.

Parameters
keyUnique identifier for this schema.
fnFunction that returns a PropertyTree schema.

◆ registerSchemaDerivedType()

void tesseract::common::registerSchemaDerivedType ( const std::string &  base_type,
const std::string &  derived_type 
)

Register that a derived type schema can be used where a base type is expected.

Parameters
base_typeThe base type name
derived_typeThe derived type name