geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
Public Member Functions | Static Public Member Functions | List of all members
geopm::SaveControlImp Class Reference

#include <SaveControl.hpp>

Inheritance diagram for geopm::SaveControlImp:
Inheritance graph
[legend]
Collaboration diagram for geopm::SaveControlImp:
Collaboration graph
[legend]

Public Member Functions

 SaveControlImp (const std::vector< m_setting_s > &settings)
 
 SaveControlImp (const std::string &json_string)
 
 SaveControlImp (IOGroup &io_group, const PlatformTopo &topo)
 
virtual ~SaveControlImp ()=default
 
std::string json (void) const override
 Get saved control settings JSON. More...
 
std::vector< m_setting_ssettings (void) const override
 Get saved control settings structures. More...
 
void write_json (const std::string &save_path) const override
 Write the JSON formatted settings to a file. More...
 
void restore (IOGroup &io_group) const override
 Write all of the control settings to the platform. More...
 
std::set< std::string > unsaved_controls (const std::set< std::string > &all_controls) const override
 
- Public Member Functions inherited from geopm::SaveControl
 SaveControl ()=default
 
virtual ~SaveControl ()=default
 

Static Public Member Functions

static std::string json (const std::vector< m_setting_s > &settings)
 
static std::vector< m_setting_ssettings (const std::string &json_string)
 
static std::vector< m_setting_ssettings (IOGroup &io_group, const PlatformTopo &topo)
 
- Static Public Member Functions inherited from geopm::SaveControl
static std::unique_ptr< SaveControlmake_unique (const std::vector< m_setting_s > &settings)
 Create a unique pointer to SaveControl object from a vector of setting structures. More...
 
static std::unique_ptr< SaveControlmake_unique (const std::string &json_string)
 Create a unique pointer to SaveControl object from a JSON formatted string. More...
 
static std::unique_ptr< SaveControlmake_unique (IOGroup &io_group)
 Create a unique pointer to SaveControl object by querying an IOGroup. More...
 

Constructor & Destructor Documentation

◆ SaveControlImp() [1/3]

geopm::SaveControlImp::SaveControlImp ( const std::vector< m_setting_s > &  settings)

◆ SaveControlImp() [2/3]

geopm::SaveControlImp::SaveControlImp ( const std::string &  json_string)

◆ SaveControlImp() [3/3]

geopm::SaveControlImp::SaveControlImp ( IOGroup io_group,
const PlatformTopo topo 
)

◆ ~SaveControlImp()

virtual geopm::SaveControlImp::~SaveControlImp ( )
virtualdefault

Member Function Documentation

◆ json() [1/2]

std::string geopm::SaveControlImp::json ( const std::vector< m_setting_s > &  settings)
static

◆ json() [2/2]

std::string geopm::SaveControlImp::json ( void  ) const
overridevirtual

Get saved control settings JSON.

Returns
A JSON representation of a vector of m_setting_s structures

Implements geopm::SaveControl.

◆ restore()

void geopm::SaveControlImp::restore ( IOGroup io_group) const
overridevirtual

Write all of the control settings to the platform.

Make a sequence of calls to io_group.write_control() with the parameters returned by the settings() method.

Parameters
io_group[in] An IOGroup that implements controls

Implements geopm::SaveControl.

◆ settings() [1/3]

std::vector< SaveControl::m_setting_s > geopm::SaveControlImp::settings ( const std::string &  json_string)
static

◆ settings() [2/3]

std::vector< SaveControl::m_setting_s > geopm::SaveControlImp::settings ( IOGroup io_group,
const PlatformTopo topo 
)
static

◆ settings() [3/3]

std::vector< SaveControl::m_setting_s > geopm::SaveControlImp::settings ( void  ) const
overridevirtual

Get saved control settings structures.

Returns
Vector of setting structures that represent the saved control state.

Implements geopm::SaveControl.

◆ unsaved_controls()

std::set< std::string > geopm::SaveControlImp::unsaved_controls ( const std::set< std::string > &  all_controls) const
overridevirtual

Implements geopm::SaveControl.

◆ write_json()

void geopm::SaveControlImp::write_json ( const std::string &  save_path) const
overridevirtual

Write the JSON formatted settings to a file.

Writes the string to the specified output file. The file is overwritten if it already exists. An exception is raised if the directory containing the output does not exist, or if the file cannot be created for any other reason.

Parameters
save_path[in] The file path where the JSON string is written.

Implements geopm::SaveControl.


The documentation for this class was generated from the following files: