treqs::Resource Class Reference

#include <Resource.h>

List of all members.

Public Member Functions

 Resource ()
virtual ~Resource ()
unsigned int getPvrId () const
 Getter for member.
int getTotalAllocation () const
 Getter for member.
float getUserAllocation (string user)
int getUsedResources (string user)
time_t getTimestamp () const
 Getter for member.
void setPvrId (int p)
 Setter for member.
void setTotalAllocation (int t)
 Setter for member.
void setUserAllocation (string u, float a)
 Setter for member.
void setUserAllocation (pair< string, float > p)
 Setter for member.
void setUsedResources (string u, int r)
 Setter for member.
void setTimestamp (time_t t)
 Setter for member.
int getAge ()
std::map< std::string, float > * getUserAllocation ()
std::map< std::string, int > * getUsedResources ()
int incUsedResources (string u)
void resetTimestamp ()
 set timestamp to now
void resetUsedResources ()
 set all used resources to 0
int countFreeResources ()
 return the count of resources available

Private Attributes

int PvrId
 ID of the PVR for this resource.
int TotalAllocation
 Total resource (drives) attribution.
std::map< std::string, float > UserAllocation
 Allocated resource for a user, as a fraction of TotalAllocation.
std::map< std::string, int > UsedResources
 Resources currently used for a user.
time_t Timestamp
 Date of the last data refresh.

Detailed Description

This class contains the resource allocation for a given PVR (aka media type)


Constructor & Destructor Documentation

treqs::Resource::Resource (  ) 
treqs::Resource::~Resource (  )  [virtual]

Member Function Documentation

int treqs::Resource::countFreeResources (  ) 

return the count of resources available

int treqs::Resource::getAge (  ) 

Returns the age of the data in seconds

Returns:
seconds since last data refresh
unsigned int treqs::Resource::getPvrId (  )  const

Getter for member.

time_t treqs::Resource::getTimestamp (  )  const

Getter for member.

int treqs::Resource::getTotalAllocation (  )  const

Getter for member.

std::map< std::string, int > * treqs::Resource::getUsedResources (  ) 

Returns a pointer to the map of used resources

Returns:
a pointer to the map of used resources
int treqs::Resource::getUsedResources ( string  user  ) 

Returns the resource usage for a given user

Parameters:
user the user name
Returns:
the number of used resources
std::map< std::string, float > * treqs::Resource::getUserAllocation (  ) 

Returns a pointer to the map of user allocations

Returns:
a pointer to the map of user allocations
float treqs::Resource::getUserAllocation ( string  user  ) 

Returns the allocation for a given user

Parameters:
user the user name
Returns:
the allocation, 0 if none
int treqs::Resource::incUsedResources ( string  u  ) 

increment the used resources for a given user. If the user reference doesn't exist, create it

Parameters:
u the reference to the user
void treqs::Resource::resetTimestamp (  ) 

set timestamp to now

void treqs::Resource::resetUsedResources (  ) 

set all used resources to 0

void treqs::Resource::setPvrId ( int  p  ) 

Setter for member.

Here is the caller graph for this function:

void treqs::Resource::setTimestamp ( time_t  t  ) 

Setter for member.

Here is the caller graph for this function:

void treqs::Resource::setTotalAllocation ( int  t  ) 

Setter for member.

Here is the caller graph for this function:

void treqs::Resource::setUsedResources ( string  u,
int  r 
)

Setter for member.

void treqs::Resource::setUserAllocation ( pair< string, float >  p  ) 

Setter for member.

void treqs::Resource::setUserAllocation ( string  u,
float  a 
)

Setter for member.


Member Data Documentation

int treqs::Resource::PvrId [private]

ID of the PVR for this resource.

time_t treqs::Resource::Timestamp [private]

Date of the last data refresh.

Total resource (drives) attribution.

std::map<std::string, int> treqs::Resource::UsedResources [private]

Resources currently used for a user.

std::map<std::string, float> treqs::Resource::UserAllocation [private]

Allocated resource for a user, as a fraction of TotalAllocation.


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

Generated on 4 Mar 2010 for TReqS by  doxygen 1.6.1