Robot Raconteur Core C++ Library
Loading...
Searching...
No Matches
RobotRaconteur::NodeDirectoriesUtil Class Reference

Utility functions for working with NodeDirectories. More...

#include <NodeDirectories.h>

Static Public Member Functions

static NodeDirectories GetDefaultNodeDirectories (const boost::shared_ptr< RobotRaconteurNode > &node=boost::shared_ptr< RobotRaconteurNode >())
 Get the Default Node Directories object.
static std::string GetLogonUserName ()
 Get the logon name of the current user.
static bool IsLogonUserRoot ()
 Returns true if user is root.
static bool ReadInfoFile (const boost::filesystem::path &fname, std::map< std::string, std::string > &data)
 Create directories with user permissions.
static boost::shared_ptr< NodeDirectoriesFD > CreatePidFile (const boost::filesystem::path &path)
 Create a pid file.
static boost::shared_ptr< NodeDirectoriesFD > CreateInfoFile (const boost::filesystem::path &path, std::map< std::string, std::string > info)
 Create an info file with key-value pairs.
static void RefreshInfoFile (const boost::shared_ptr< NodeDirectoriesFD > &h_info, const std::map< std::string, std::string > &updated_info)
 Update key-value pairs in a file created with CreateInfoFile().

Detailed Description

Utility functions for working with NodeDirectories.

Member Function Documentation

◆ CreateInfoFile()

boost::shared_ptr< NodeDirectoriesFD > RobotRaconteur::NodeDirectoriesUtil::CreateInfoFile ( const boost::filesystem::path & path,
std::map< std::string, std::string > info )
static

Create an info file with key-value pairs.

The file will be locked for writing. The file will be deleted and unlocked when handle is destroyed.

Parameters
pathThe info filename
infoThe key-value pairs to write to the file.
Returns
RR_SHARED_PTR<NodeDirectoriesFD> Handle to pid file. Destroy to delete and release the file lock.

◆ CreatePidFile()

boost::shared_ptr< NodeDirectoriesFD > RobotRaconteur::NodeDirectoriesUtil::CreatePidFile ( const boost::filesystem::path & path)
static

Create a pid file.

Creates a file with the current program's pid. The file will also be locked for writing. The file will be deleted and unlocked when handle is destroyed.

Parameters
pathThe pid file filename
Returns
RR_SHARED_PTR<NodeDirectoriesFD> Handle to pid file. Destroy to delete and release the file lock.

◆ GetDefaultNodeDirectories()

NodeDirectories RobotRaconteur::NodeDirectoriesUtil::GetDefaultNodeDirectories ( const boost::shared_ptr< RobotRaconteurNode > & node = boost::shared_ptr< RobotRaconteurNode >())
static

Get the Default Node Directories object.

Parameters
nodeThe node to send logging information (optional)
create_user_dirsCreate user directories if they don't exist (optional)
Returns
NodeDirectories The default node directories

◆ GetLogonUserName()

std::string RobotRaconteur::NodeDirectoriesUtil::GetLogonUserName ( )
static

Get the logon name of the current user.

Returns
std::string

◆ IsLogonUserRoot()

bool RobotRaconteur::NodeDirectoriesUtil::IsLogonUserRoot ( )
static

Returns true if user is root.

Returns
true
false

◆ ReadInfoFile()

bool RobotRaconteur::NodeDirectoriesUtil::ReadInfoFile ( const boost::filesystem::path & fname,
std::map< std::string, std::string > & data )
static

Create directories with user permissions.

Parent directories are created, existing directories ignored

Parameters
dirThe directories tree to create

Create directories with private system permissions

Parent directories are created, existing directories ignored

Parameters
dirThe directories tree to create

Create directories with public system permissions

Parent directories are created, existing directories ignored Typically these directories will allow the "robotraconteur" group ("RobotRaconteur" on Windows) access.

Parameters
dirThe directories tree to create

Create a directory with user run permissions

Parameters
node_dirsThe directories to create

Read an info file with key-value pairs

Parameters
fnameThe file to read
data(out) The map to fill with read values
Returns
true Success
false Failure

◆ RefreshInfoFile()

void RobotRaconteur::NodeDirectoriesUtil::RefreshInfoFile ( const boost::shared_ptr< NodeDirectoriesFD > & h_info,
const std::map< std::string, std::string > & updated_info )
static

Update key-value pairs in a file created with CreateInfoFile().

Replaces key-value pairs in a file opened with CreateInfoFile()

Parameters
h_infoHandle to the opened info file
updated_infoKey-value pairs to replace in the info file.

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