23#ifndef DOBBYTEMPLATE_H
24#define DOBBYTEMPLATE_H
28#pragma GCC diagnostic push
29# pragma GCC diagnostic ignored "-Wshadow"
30# include <ctemplate/template.h>
31#pragma GCC diagnostic pop
58 const ctemplate::TemplateString mTemplateKey;
59 const std::unique_ptr<ctemplate::TemplateCache> mTemplateCache;
68 void _setSettings(
const std::shared_ptr<const IDobbySettings>& settings);
70 std::string
_apply(
const ctemplate::TemplateDictionaryInterface* dictionary,
71 bool prettyPrint)
const;
73 bool _applyAt(
int dirFd,
const std::string& fileName,
74 const ctemplate::TemplateDictionaryInterface* dictionary,
75 bool prettyPrint)
const;
78 static void setSettings(
const std::shared_ptr<const IDobbySettings>& settings);
80 static std::string
apply(
const ctemplate::TemplateDictionaryInterface* dictionary,
83 static bool applyAt(
int dirFd,
const std::string& fileName,
84 const ctemplate::TemplateDictionaryInterface* dictionary,
88 std::map<std::string, std::string> mExtraEnvVars;
91 static pthread_rwlock_t mInstanceLock;
Singleton class that returns the OCI JSON template.
Definition DobbyTemplate.h:52
static void setSettings(const std::shared_ptr< const IDobbySettings > &settings)
Applies the settings to the global template values.
Definition DobbyTemplate.cpp:138
void setTemplateCpuRtSched()
Determines if the kernel's CONFIG_RT_GROUP_SCHED is set or not.
Definition DobbyTemplate.cpp:451
std::string _apply(const ctemplate::TemplateDictionaryInterface *dictionary, bool prettyPrint) const
Applies the dictionary to the template.
Definition DobbyTemplate.cpp:530
static std::string apply(const ctemplate::TemplateDictionaryInterface *dictionary, bool prettyPrint)
Applies the dictionary to the template.
Definition DobbyTemplate.cpp:561
static DobbyTemplate * instance()
Returns / creates singleton instance.
Definition DobbyTemplate.cpp:109
bool _applyAt(int dirFd, const std::string &fileName, const ctemplate::TemplateDictionaryInterface *dictionary, bool prettyPrint) const
Applies the dictionary to the template and writes the output into the file.
Definition DobbyTemplate.cpp:634
void setTemplatePlatformEnvVars()
Sets the environment variables used to identify the platform.
Definition DobbyTemplate.cpp:393
static void cleanUp()
Called at shutdown time to clean up the singleton.
Definition DobbyTemplate.cpp:90
static bool applyAt(int dirFd, const std::string &fileName, const ctemplate::TemplateDictionaryInterface *dictionary, bool prettyPrint)
Applies the dictionary to the template and writes the output into the file.
Definition DobbyTemplate.cpp:697
void setTemplateDevNodes(const std::list< std::string > &devNodes)
Sets up the global template values for the device nodes.
Definition DobbyTemplate.cpp:241
void _setSettings(const std::shared_ptr< const IDobbySettings > &settings)
Applies the settings to the global template values.
Definition DobbyTemplate.cpp:149
void setTemplateEnvVars(const std::map< std::string, std::string > &envVars)
Converts the envVars map to json formatted string and sets it as the EXTRA_ENV_VARS template value.
Definition DobbyTemplate.cpp:362
Interface provided to the library at startup, contains the configuration options for Dobby.
Definition IDobbySettings.h:50