// wrapConfigManager.cpp
// This file is generated by Shroud 0.12.2. Do not edit.
#include "wrapConfigManager.h"

#include "caliper/ConfigManager.h"
#include <string>
#include <cstddef>
#include <cstring>

// splicer begin class.ConfigManager.CXX_definitions
// splicer end class.ConfigManager.CXX_definitions

extern "C" {


// helper ShroudStrToArray
// Save str metadata into array to allow Fortran to access values.
// CHARACTER(len=elem_size) src
static void ShroudStrToArray(cali_SHROUD_array *array, const std::string * src, int idtor)
{
    array->cxx.addr = const_cast<std::string *>(src);
    array->cxx.idtor = idtor;
    if (src->empty()) {
        array->addr.ccharp = NULL;
        array->elem_len = 0;
    } else {
        array->addr.ccharp = src->data();
        array->elem_len = src->length();
    }
    array->size = 1;
    array->rank = 0;  // scalar
}
// splicer begin class.ConfigManager.C_definitions
// splicer end class.ConfigManager.C_definitions

cali_ConfigManager * cali_ConfigManager_new(
    cali_ConfigManager * SHadow_rv)
{
    // splicer begin class.ConfigManager.method.new
    cali::ConfigManager *SHCXX_rv = new cali::ConfigManager();
    SHadow_rv->addr = static_cast<void *>(SHCXX_rv);
    SHadow_rv->idtor = 3;
    return SHadow_rv;
    // splicer end class.ConfigManager.method.new
}

void cali_ConfigManager_delete(cali_ConfigManager * self)
{
    cali::ConfigManager *SH_this = static_cast<cali::ConfigManager *>
        (self->addr);
    // splicer begin class.ConfigManager.method.delete
    delete SH_this;
    self->addr = nullptr;
    // splicer end class.ConfigManager.method.delete
}

void cali_ConfigManager_set_default_parameter(cali_ConfigManager * self,
    const char * option, const char * val)
{
    cali::ConfigManager *SH_this = static_cast<cali::ConfigManager *>
        (self->addr);
    // splicer begin class.ConfigManager.method.set_default_parameter
    SH_this->set_default_parameter(option, val);
    // splicer end class.ConfigManager.method.set_default_parameter
}

void cali_ConfigManager_add(cali_ConfigManager * self,
    const char * config)
{
    cali::ConfigManager *SH_this = static_cast<cali::ConfigManager *>
        (self->addr);
    // splicer begin class.ConfigManager.method.add
    SH_this->add(config);
    // splicer end class.ConfigManager.method.add
}

bool cali_ConfigManager_error(cali_ConfigManager * self)
{
    cali::ConfigManager *SH_this = static_cast<cali::ConfigManager *>
        (self->addr);
    // splicer begin class.ConfigManager.method.error
    bool SHC_rv = SH_this->error();
    return SHC_rv;
    // splicer end class.ConfigManager.method.error
}

void cali_ConfigManager_error_msg_bufferify(cali_ConfigManager * self,
    cali_SHROUD_array *DSHF_rv)
{
    cali::ConfigManager *SH_this = static_cast<cali::ConfigManager *>
        (self->addr);
    // splicer begin class.ConfigManager.method.error_msg_bufferify
    std::string * SHCXX_rv = new std::string;
    *SHCXX_rv = SH_this->error_msg();
    ShroudStrToArray(DSHF_rv, SHCXX_rv, 4);
    // splicer end class.ConfigManager.method.error_msg_bufferify
}

void cali_ConfigManager_start(cali_ConfigManager * self)
{
    cali::ConfigManager *SH_this = static_cast<cali::ConfigManager *>
        (self->addr);
    // splicer begin class.ConfigManager.method.start
    SH_this->start();
    // splicer end class.ConfigManager.method.start
}

void cali_ConfigManager_stop(cali_ConfigManager * self)
{
    cali::ConfigManager *SH_this = static_cast<cali::ConfigManager *>
        (self->addr);
    // splicer begin class.ConfigManager.method.stop
    SH_this->stop();
    // splicer end class.ConfigManager.method.stop
}

void cali_ConfigManager_flush(cali_ConfigManager * self)
{
    cali::ConfigManager *SH_this = static_cast<cali::ConfigManager *>
        (self->addr);
    // splicer begin class.ConfigManager.method.flush
    SH_this->flush();
    // splicer end class.ConfigManager.method.flush
}

}  // extern "C"
