OPTK  0.1.2
Toolkit for global optimisation algorithms
Macros | Functions
types.cpp File Reference

Implements the main types used in the program. More...

#include <optk/types.hpp>

Macros

#define deltype(type, src)
 

Functions

static bool dbleq (double a, double b)
 
static sspace::param_tfind_key (const std::string &k, sspace::sspace_t *sspace)
 
static void validate_int_value (int ival, sspace::param_t *iparam)
 
static void validate_dbl_value (double dval, sspace::param_t *dparam)
 
static void validate_str_value (std::string sval, sspace::param_t *sparam)
 

Detailed Description

Implements the main types used in the program.

Copyright (C) 2020 Maxime Robeyns maxim.nosp@m.erob.nosp@m.eyns@.nosp@m.gmai.nosp@m.l.com

Written for the ACRC, University of Bristol

Licensed under the Educational Community 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.osedu.org/licenses/ECL-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

◆ deltype

#define deltype (   type,
  src 
)
Value:
{ \
type *tmp_type = static_cast<type *>(src); \
delete tmp_type; \
break; \
}

Function Documentation

◆ find_key()

static sspace::param_t* find_key ( const std::string &  k,
sspace::sspace_t sspace 
)
static

Searches a vector of sspace::param_t values for an element matching the provided key. Throws an exception upon error.

Parameters
kThe key to search for
sspaceThe vector of sspace::param_t values to search through.
Exceptions
std::invalid_argumentWhen the key cannot be found.

◆ validate_dbl_value()

static void validate_dbl_value ( double  dval,
sspace::param_t dparam 
)
static

Validates a double-valued parameter.

Parameters
dvalA double-precision floating point value
dparamThe corresponding specification for the parameter
Exceptions
std::invalid_argumentif dval is invalid under dparam.

◆ validate_int_value()

static void validate_int_value ( int  ival,
sspace::param_t iparam 
)
static

Validates an integer-valued parameter.

Parameters
ivalAn integer
iparamThe corresponding specification for the parameter
Exceptions
std::invalid_argumentif ival is invalid under iparam.

◆ validate_str_value()

static void validate_str_value ( std::string  sval,
sspace::param_t sparam 
)
static

Validates a string-valued parameter.

Parameters
svalA string value
sparamThe corresponding specification for the parameter
Exceptions
std::invalid_argumentif sval is invalid under sparam.