PTLib  Version 2.14.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PHTTPSpace Class Reference

This class describes a name space that a Universal Resource Locator operates in. More...

#include <http.h>

Inheritance diagram for PHTTPSpace:
Collaboration diagram for PHTTPSpace:

Classes

class  Node
 

Public Types

enum  AddOptions { ErrorOnExist, Overwrite }
 

Public Member Functions

 PHTTPSpace ()
 Constructor for HTTP URL Name Space. More...
 
PBoolean AddResource (PHTTPResource *resource, AddOptions overwrite=ErrorOnExist)
 Add a new resource to the URL space. More...
 
PBoolean DelResource (const PURL &url)
 Delete an existing resource to the URL space. More...
 
PHTTPResourceFindResource (const PURL &url)
 Locate the resource specified by the URL in the URL name space. More...
 
void StartRead () const
 This function attempts to acquire the mutex for reading. More...
 
void EndRead () const
 This function attempts to release the mutex for reading. More...
 
void StartWrite () const
 This function attempts to acquire the mutex for writing. More...
 
void EndWrite () const
 This function attempts to release the mutex for writing. More...
 
- Public Member Functions inherited from PContainer
 PContainer (PINDEX initialSize=0)
 Create a new unique container. More...
 
 PContainer (const PContainer &cont)
 Create a new refernce to container. More...
 
PContaineroperator= (const PContainer &cont)
 Assign one container reference to another. More...
 
virtual ~PContainer ()
 Destroy the container class. More...
 
virtual PINDEX GetSize () const
 Get the current size of the container. More...
 
__inline size_t size () const
 
PBoolean SetMinSize (PINDEX minSize)
 Set the minimum size of container. More...
 
virtual PBoolean IsEmpty () const
 Determine if the container is empty. More...
 
__inline bool empty () const
 
PBoolean IsUnique () const
 Determine if container is unique reference. More...
 
virtual PBoolean MakeUnique ()
 Make this instance to be the one and only reference to the container contents. More...
 
- Public Member Functions inherited from PObject
unsigned GetTraceContextIdentifier () const
 Get PTRACE context identifier. More...
 
void SetTraceContextIdentifier (unsigned id)
 
void GetTraceContextIdentifier (PObject &obj)
 
void GetTraceContextIdentifier (PObject *obj)
 
void SetTraceContextIdentifier (const PObject &obj)
 
void SetTraceContextIdentifier (const PObject *obj)
 
virtual ~PObject ()
 
virtual PObjectClone () const
 Create a copy of the class on the heap. More...
 
template<class CLS >
CLS * CloneAs () const
 As for Clone() but converts to specified type. More...
 
virtual PINDEX HashFunction () const
 This function yields a hash value required by the PDictionary class. More...
 
virtual Comparison Compare (const PObject &obj) const
 Compare the two objects and return their relative rank. More...
 
virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
 Determine the byte wise comparison of two objects. More...
 
bool operator== (const PObject &obj) const
 Compare the two objects. More...
 
bool operator!= (const PObject &obj) const
 Compare the two objects. More...
 
bool operator< (const PObject &obj) const
 Compare the two objects. More...
 
bool operator> (const PObject &obj) const
 Compare the two objects. More...
 
bool operator<= (const PObject &obj) const
 Compare the two objects. More...
 
bool operator>= (const PObject &obj) const
 Compare the two objects. More...
 
virtual const char * GetClass (unsigned ancestor=0) const
 Get the current dynamic type of the object instance. More...
 
PBoolean IsClass (const char *cls) const
 
virtual PBoolean InternalIsDescendant (const char *clsName) const
 Determine if the dynamic type of the current instance is a descendent of the specified class. More...
 
__inline const PObjectPTraceObjectInstance () const
 
virtual void PrintOn (ostream &strm) const
 Output the contents of the object to the stream. More...
 
virtual void ReadFrom (istream &strm)
 Input the contents of the object from the stream. More...
 

Protected Member Functions

 PSORTED_LIST (ChildList, Node)
 
- Protected Member Functions inherited from PContainer
 PContainer (int dummy, const PContainer *cont)
 Constructor used in support of the Clone() function. More...
 
 PContainer (PContainerReference &reference)
 Construct using static PContainerReference. More...
 
virtual void DestroyContents ()=0
 Destroy the container contents. More...
 
virtual void AssignContents (const PContainer &c)
 Copy the container contents. More...
 
void CopyContents (const PContainer &c)
 Copy the container contents. More...
 
void CloneContents (const PContainer *src)
 Create a duplicate of the container contents. More...
 
void Destruct ()
 Internal function called from container destructors. More...
 
virtual void DestroyReference ()
 Destroy the PContainerReference instance. More...
 
- Protected Member Functions inherited from PObject
 PObject ()
 Constructor for PObject, made protected so cannot ever create one on its own. More...
 

Protected Attributes

PReadWriteMutexmutex
 
PHTTPSpace::Noderoot
 
- Protected Attributes inherited from PContainer
PContainerReferencereference
 
- Protected Attributes inherited from PObject
unsigned m_traceContextIdentifier
 

Additional Inherited Members

- Static Public Member Functions inherited from PObject
static Comparison InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size)
 Internal function caled from CompareObjectMemoryDirect() More...
 
static const char * Class ()
 Get the name of the class as a C string. More...
 
static __inline const PObjectPTraceObjectInstance (const char *)
 
static __inline const PObjectPTraceObjectInstance (const PObject *obj)
 
- Friends inherited from PObject

Detailed Description

This class describes a name space that a Universal Resource Locator operates in.

Each section of the hierarchy field of the URL points to a leg in the tree specified by this class.

Member Enumeration Documentation

Enumerator
ErrorOnExist 

Generate error if resource already exists.

Overwrite 

Overwrite the existing resource at URL location.

Constructor & Destructor Documentation

PHTTPSpace::PHTTPSpace ( )

Constructor for HTTP URL Name Space.

Member Function Documentation

PBoolean PHTTPSpace::AddResource ( PHTTPResource resource,
AddOptions  overwrite = ErrorOnExist 
)

Add a new resource to the URL space.

If there is already a resource at the location in the tree, or that location in the tree is already in the path to another resource then the function will fail.

The overwrite flag can be used to replace an existing resource. The function will still fail if the resource is on a partial path to another resource but not if it is a leaf node.

Returns
true if resource added, false if failed.
Parameters
resourceResource to add to the name space.
overwriteFlag to overwrite an existing resource if it already exists.
PBoolean PHTTPSpace::DelResource ( const PURL url)

Delete an existing resource to the URL space.

If there is not a resource at the location in the tree, or that location in the tree is in the path to another resource then the function will fail.

Returns
true if resource deleted, false if failed.
Parameters
urlURL to search for in the name space.
void PHTTPSpace::EndRead ( ) const
inline

This function attempts to release the mutex for reading.

References PReadWriteMutex::EndRead(), and mutex.

void PHTTPSpace::EndWrite ( ) const
inline

This function attempts to release the mutex for writing.

References PReadWriteMutex::EndWrite(), and mutex.

PHTTPResource* PHTTPSpace::FindResource ( const PURL url)

Locate the resource specified by the URL in the URL name space.

Returns
The resource found or NULL if no resource at that position in hiearchy.
Parameters
urlURL to search for in the name space.
PHTTPSpace::PSORTED_LIST ( ChildList  ,
Node   
)
protected
void PHTTPSpace::StartRead ( ) const
inline

This function attempts to acquire the mutex for reading.

References mutex, and PReadWriteMutex::StartRead().

void PHTTPSpace::StartWrite ( ) const
inline

This function attempts to acquire the mutex for writing.

References mutex, and PReadWriteMutex::StartWrite().

Member Data Documentation

PReadWriteMutex* PHTTPSpace::mutex
protected
PHTTPSpace::Node * PHTTPSpace::root
protected

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