1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

clang format apply

This commit is contained in:
Leonid Fedorov
2022-01-21 16:43:49 +00:00
parent 6b6411229f
commit 04752ec546
1376 changed files with 393460 additions and 412662 deletions

View File

@ -16,9 +16,9 @@
MA 02110-1301, USA. */
/******************************************************************************************
* $Id: configcpp.h 3495 2013-01-21 14:09:51Z rdempsey $
*
******************************************************************************************/
* $Id: configcpp.h 3495 2013-01-21 14:09:51Z rdempsey $
*
******************************************************************************************/
/**
* @file
*/
@ -38,7 +38,6 @@
namespace messageqcpp
{
class ByteStream;
}
@ -51,7 +50,6 @@ class ByteStream;
namespace config
{
/** @brief a config file I/F class
*
* This is a singleton pattern: you must use the makeConfig() factory method to get a
@ -61,201 +59,199 @@ namespace config
*/
class Config
{
public:
/** @brief Config factory method
*
* Creates a singleton Config object
*/
EXPORT static Config* makeConfig(const char* cf = 0);
public:
/** @brief Config factory method
*
* Creates a singleton Config object
*/
EXPORT static Config* makeConfig(const char* cf = 0);
/** @brief Config factory method
*
* Creates a singleton Config object
*/
EXPORT static Config* makeConfig(const std::string& cf);
/** @brief Config factory method
*
* Creates a singleton Config object
*/
EXPORT static Config* makeConfig(const std::string& cf);
/** @brief dtor
*/
EXPORT virtual ~Config();
/** @brief dtor
*/
EXPORT virtual ~Config();
/** @brief get name's value from section
*
* get name's value from section in the current config file.
* @param section the name of the config file section to search
* @param name the param name whose value is to be returned
*/
EXPORT const std::string getConfig(const std::string& section, const std::string& name);
/** @brief get name's value from section
*
* get name's value from section in the current config file.
* @param section the name of the config file section to search
* @param name the param name whose value is to be returned
*/
EXPORT const std::string getConfig(const std::string& section, const std::string& name);
/** @brief get name's value from section
*
* get name's value from section in the current config file re-reading the
* config file if it was updated.
* @param section the name of the config file section to search
* @param name the param name whose value is to be returned
*/
const std::string getFromActualConfig(const std::string& section, const std::string& name);
/** @brief get name's value from section
*
* get name's value from section in the current config file re-reading the
* config file if it was updated.
* @param section the name of the config file section to search
* @param name the param name whose value is to be returned
*/
const std::string getFromActualConfig(const std::string& section, const std::string& name);
/** @brief get all name's values from a section
*
* get name's values from section in the current config file.
* @param section the name of the config file section to search
* @param name the param name whose value is to be returned
* @param values the values in the section are returned in this vector
*/
EXPORT void getConfig(const std::string& section, const std::string& name,
std::vector<std::string>& values);
/** @brief get all name's values from a section
*
* get name's values from section in the current config file.
* @param section the name of the config file section to search
* @param name the param name whose value is to be returned
* @param values the values in the section are returned in this vector
*/
EXPORT void getConfig(const std::string& section, const std::string& name,
std::vector<std::string>& values);
/** @brief set name's value in section
*
* set name's value in section in the current config file.
* @param section the name of the config file section to update
* @param name the param name whose value is to be updated
* @param value the param value
*/
// !!!Don't ever ever use this in the engine code b/c it might result in a race
// b/w getConfig and setConfig methods.!!!
EXPORT void setConfig(const std::string& section, const std::string& name, const std::string& value);
/** @brief set name's value in section
*
* set name's value in section in the current config file.
* @param section the name of the config file section to update
* @param name the param name whose value is to be updated
* @param value the param value
*/
// !!!Don't ever ever use this in the engine code b/c it might result in a race
// b/w getConfig and setConfig methods.!!!
EXPORT void setConfig(const std::string& section, const std::string& name, const std::string& value);
/** @brief delete name from section
*
* delete name from section in the current config file.
* @param section the name of the config file section to search
* @param name the param name whose entry is to be deleted
* @note if you delete the last param from a section, the section will still remain
*/
EXPORT void delConfig(const std::string& section, const std::string& name);
/** @brief delete name from section
*
* delete name from section in the current config file.
* @param section the name of the config file section to search
* @param name the param name whose entry is to be deleted
* @note if you delete the last param from a section, the section will still remain
*/
EXPORT void delConfig(const std::string& section, const std::string& name);
/** @brief write the config file back out to disk
*
* write the config file back out to disk using the current filename.
*/
EXPORT void write(void) const;
/** @brief write the config file back out to disk
*
* write the config file back out to disk using the current filename.
*/
EXPORT void write(void) const;
/** @brief write the config file back out to disk as fileName
*
* write the config file out to disk as a new file fileName. Does not affect the current
* config filename.
*/
EXPORT void write(const std::string& fileName) const;
/** @brief write the config file back out to disk as fileName
*
* write the config file out to disk as a new file fileName. Does not affect the current
* config filename.
*/
EXPORT void write(const std::string& fileName) const;
/** @brief write a stream copy of config file to disk
*
* write a stream copy of config file to disk. used to distributed mass updates to system nodes
*
*/
EXPORT void writeConfigFile(messageqcpp::ByteStream msg) const;
/** @brief write a stream copy of config file to disk
*
* write a stream copy of config file to disk. used to distributed mass updates to system nodes
*
*/
EXPORT void writeConfigFile(messageqcpp::ByteStream msg) const;
/** @brief return the name of this config file
*
* return the name of this config file.
*/
EXPORT inline const std::string& configFile() const
{
return fConfigFile;
}
/** @brief return the name of this config file
*
* return the name of this config file.
*/
EXPORT inline const std::string& configFile() const
{
return fConfigFile;
}
/** @brief delete all config file instances
*
* deletes \b all config file maps
*/
EXPORT static void deleteInstanceMap();
/** @brief delete all config file instances
*
* deletes \b all config file maps
*/
EXPORT static void deleteInstanceMap();
/** @brief parse config file numerics
*
* Convert human-friendly number formats to machine-friendly. Handle suffixes 'K', 'M', 'G'.
* Handle decimal, hex and octal notation in the same way as the C compiler.
* Ignore any 'B' following [KMG]. Ignore case in suffixes.
* An empty string or an unparseable string returns 0.
* Return a signed numeric value.
*/
EXPORT static int64_t fromText(const std::string& text);
/** @brief parse config file numerics
*
* Convert human-friendly number formats to machine-friendly. Handle suffixes 'K', 'M', 'G'.
* Handle decimal, hex and octal notation in the same way as the C compiler.
* Ignore any 'B' following [KMG]. Ignore case in suffixes.
* An empty string or an unparseable string returns 0.
* Return a signed numeric value.
*/
EXPORT static int64_t fromText(const std::string& text);
/** @brief parse config file numerics
*
* Return an unsigned numeric value.
*/
EXPORT static inline uint64_t uFromText(const std::string& text)
{
return static_cast<uint64_t>(fromText(text));
}
/** @brief parse config file numerics
*
* Return an unsigned numeric value.
*/
EXPORT static inline uint64_t uFromText(const std::string& text)
{
return static_cast<uint64_t>(fromText(text));
}
/** @brief Used externally to check whether there has been a config change without loading everything
*
*/
inline time_t getLastMTime() const
{
return fMtime;
}
/** @brief Used externally to check whether there has been a config change without loading everything
*
*/
inline time_t getLastMTime() const
{
return fMtime;
}
/** @brief Used externally to check whether there has been a config change without loading everything
*
*/
EXPORT time_t getCurrentMTime();
/** @brief Used externally to check whether there has been a config change without loading everything
*
*/
EXPORT time_t getCurrentMTime();
/** @brief Enumerate all the sections in the config file
*
*/
EXPORT const std::vector<std::string> enumConfig();
/** @brief Enumerate all the sections in the config file
*
*/
EXPORT const std::vector<std::string> enumConfig();
/** @brief Enumerate all the names in a section in the config file
*
*/
EXPORT const std::vector<std::string> enumSection(const std::string& section);
/** @brief Enumerate all the names in a section in the config file
*
*/
EXPORT const std::vector<std::string> enumSection(const std::string& section);
enum class TempDirPurpose
{
Joins, ///< disk joins
Aggregates ///< disk-based aggregation
};
/** @brief Return temporaru directory path for the specified purpose */
EXPORT std::string getTempFileDir(TempDirPurpose what);
enum class TempDirPurpose
{
Joins, ///< disk joins
Aggregates ///< disk-based aggregation
};
/** @brief Return temporaru directory path for the specified purpose */
EXPORT std::string getTempFileDir(TempDirPurpose what);
protected:
/** @brief parse the XML file
*
*/
void parseDoc(void);
protected:
/** @brief parse the XML file
*
*/
void parseDoc(void);
/** @brief write the XML tree to disk
*
*/
EXPORT void writeConfig(const std::string& fileName) const;
/** @brief write the XML tree to disk
*
*/
EXPORT void writeConfig(const std::string& fileName) const;
/** @brief stop processing this XML file
*
*/
void closeConfig(void);
/** @brief stop processing this XML file
*
*/
void closeConfig(void);
private:
typedef std::map<std::string, Config*> configMap_t;
private:
typedef std::map<std::string, Config*> configMap_t;
/*
*/
Config(const Config& rhs);
/*
*/
Config& operator=(const Config& rhs);
/*
*/
Config(const Config& rhs);
/*
*/
Config& operator=(const Config& rhs);
/** @brief ctor with config file specified
*/
Config(const std::string& configFile);
/** @brief ctor with config file specified
*/
Config(const std::string& configFile);
static configMap_t fInstanceMap;
static boost::mutex fInstanceMapMutex;
static boost::mutex fXmlLock;
static boost::mutex fWriteXmlLock;
xmlDocPtr fDoc;
const std::string fConfigFile;
time_t fMtime;
mutable boost::recursive_mutex fLock;
XMLParser fParser;
static configMap_t fInstanceMap;
static boost::mutex fInstanceMapMutex;
static boost::mutex fXmlLock;
static boost::mutex fWriteXmlLock;
xmlDocPtr fDoc;
const std::string fConfigFile;
time_t fMtime;
mutable boost::recursive_mutex fLock;
XMLParser fParser;
};
}
} // namespace config
#undef EXPORT
// vim:ts=4 sw=4: