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

#include "caliper/cali.h"
#include "caliper/ConfigManager.h"
#include "BufferedRegionProfile.h"
#include "typesCaliper.h"
#include <cstdlib>

// splicer begin CXX_definitions
// splicer end CXX_definitions

extern "C" {

// splicer begin C_definitions
// splicer end C_definitions

// Release library allocated memory.
void cali_SHROUD_memory_destructor(cali_SHROUD_capsule_data *cap)
{
    void *ptr = cap->addr;
    switch (cap->idtor) {
    case 0:   // --none--
    {
        // Nothing to delete
        break;
    }
    case 1:   // cali::ScopeAnnotation
    {
        cali::ScopeAnnotation *cxx_ptr = 
            reinterpret_cast<cali::ScopeAnnotation *>(ptr);
        delete cxx_ptr;
        break;
    }
    case 2:   // cali::Annotation
    {
        cali::Annotation *cxx_ptr = 
            reinterpret_cast<cali::Annotation *>(ptr);
        delete cxx_ptr;
        break;
    }
    case 3:   // cali::ConfigManager
    {
        cali::ConfigManager *cxx_ptr = 
            reinterpret_cast<cali::ConfigManager *>(ptr);
        delete cxx_ptr;
        break;
    }
    case 4:   // new_string
    {
        std::string *cxx_ptr = reinterpret_cast<std::string *>(ptr);
        delete cxx_ptr;
        break;
    }
    case 5:   // cali::BufferedRegionProfile
    {
        cali::BufferedRegionProfile *cxx_ptr = 
            reinterpret_cast<cali::BufferedRegionProfile *>(ptr);
        delete cxx_ptr;
        break;
    }
    default:
    {
        // Unexpected case in destructor
        break;
    }
    }
    cap->addr = nullptr;
    cap->idtor = 0;  // avoid deleting again
}

}  // extern "C"
