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:

## Classes

class | Node

## Public Types

enum | AddOptions { ErrorOnExist, Overwrite }
Public Types inherited from PObject
enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
| Result of the comparison operation performed by the `Compare()` function. More...

## 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...
PHTTPResource * | FindResource (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...
PContainer & | operator= (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...
PBoolean | SetMinSize (PINDEX minSize)
| Set the minimum size of container. More...
virtual PBoolean | IsEmpty () const
| Determine if the container is empty. More...
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
virtual | ~PObject ()
virtual PObject * | Clone () const
| Create a copy of the class on the heap. 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...
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

PReadWriteMutex * | mutex
PHTTPSpace::Node * | root
Protected Attributes inherited from PContainer
PContainerReference * | reference

## 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

enum PHTTPSpace::AddOptions

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

  resource | Resource to add to the name space.
  overwrite | Flag 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

  url | URL 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

  url | URL 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

Referenced by EndRead(), EndWrite(), StartRead(), and StartWrite().

PHTTPSpace::Node * PHTTPSpace::root

protected

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

- http.h