ARC SDK
Public Types | Public Member Functions
Arc::FileInfo Class Reference

FileInfo stores information about files (metadata). More...

#include <arc/data/FileInfo.h>

Public Types

enum  Type { file_type_unknown = 0, file_type_file = 1, file_type_dir = 2 }
 Type of file object. More...
 

Public Member Functions

 FileInfo (const std::string &name="")
 Construct a new FileInfo with optional name (file path).
 
const std::string & GetName () const
 Returns the name (file path) of the file.
 
std::string GetLastName () const
 Returns the last component of the file name (like the "basename" command).
 
void SetName (const std::string &n)
 Set name of the file (file path).
 
const std::list< URL > & GetURLs () const
 Returns the list of file replicas (for index services).
 
void AddURL (const URL &u)
 Add a replica to this file.
 
bool CheckSize () const
 Check if file size is known.
 
unsigned long long int GetSize () const
 Returns file size.
 
void SetSize (const unsigned long long int s)
 Set file size.
 
bool CheckCheckSum () const
 Check if checksum is known.
 
const std::string & GetCheckSum () const
 Returns checksum.
 
void SetCheckSum (const std::string &c)
 Set checksum.
 
bool CheckModified () const
 Check if modified time is known.
 
Time GetModified () const
 Returns modified time.
 
void SetModified (const Time &t)
 Set modified time.
 
bool CheckValid () const
 Check if validity time is known.
 
Time GetValid () const
 Returns validity time.
 
void SetValid (const Time &t)
 Set validity time.
 
bool CheckType () const
 Check if file type is known.
 
Type GetType () const
 Returns file type.
 
void SetType (const Type t)
 Set file type.
 
bool CheckLatency () const
 Check if access latency is known.
 
std::string GetLatency () const
 Returns access latency.
 
void SetLatency (const std::string l)
 Set access latency.
 
std::map< std::string,
std::string > 
GetMetaData () const
 Returns map of generic metadata.
 
void SetMetaData (const std::string att, const std::string val)
 Set an attribute of generic metadata.
 
bool operator< (const FileInfo &f) const
 Returns true if this file's name is before f's name alphabetically.
 
 operator bool () const
 Returns true if file name is defined.
 
bool operator! () const
 Returns true if file name is not defined.
 

Detailed Description

FileInfo stores information about files (metadata).

Set/Get methods exist for "standard" metadata such as name, size and modification time, and there is a generic key-value map for protocol-specific attributes. The Set methods always set the corresponding entry in the generic map, so there is no need for a caller make two calls, for example SetSize(1) followed by SetMetaData("size", "1").

Member Enumeration Documentation

Type of file object.

Enumerator
file_type_unknown 

Unknown.

file_type_file 

File-type.

file_type_dir 

Directory-type.


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