User Guide
codegen_utils.hpp
Go to the documentation of this file.
1
/*
2
* Copyright 2023 Blue Brain Project, EPFL.
3
* See the top-level LICENSE file for details.
4
*
5
* SPDX-License-Identifier: Apache-2.0
6
*/
7
8
#pragma once
9
10
/**
11
* \file
12
* \brief Implement utility functions for codegen visitors
13
*
14
*/
15
16
#include <string>
17
18
namespace
nmodl
{
19
namespace
codegen {
20
namespace
utils {
21
22
/**
23
* Handles the double constants format being printed in the generated code.
24
*
25
* It takes care of printing the values with the correct floating point precision
26
* for each backend, similar to mod2c and Neuron.
27
* This function can be called using as template `CodegenCppVisitor`
28
*
29
* \param s_value The double constant as string
30
* \return The proper string to be printed in the generated file.
31
*/
32
std::string
format_double_string
(
const
std::string& s_value);
33
34
35
/**
36
* Handles the float constants format being printed in the generated code.
37
*
38
* It takes care of printing the values with the correct floating point precision
39
* for each backend, similar to mod2c and Neuron.
40
* This function can be called using as template `CodegenCppVisitor`
41
*
42
* \param s_value The double constant as string
43
* \return The proper string to be printed in the generated file.
44
*/
45
std::string
format_float_string
(
const
std::string& s_value);
46
47
}
// namespace utils
48
}
// namespace codegen
49
}
// namespace nmodl
nmodl
encapsulates code generation backend implementations
Definition:
ast_common.hpp:26
nmodl::codegen::utils::format_float_string
std::string format_float_string(const std::string &s_value)
Handles the float constants format being printed in the generated code.
Definition:
codegen_utils.cpp:32
nmodl::codegen::utils::format_double_string
std::string format_double_string(const std::string &s_value)
Handles the double constants format being printed in the generated code.
Definition:
codegen_utils.cpp:23
src
codegen
codegen_utils.hpp