KLVObject Class Reference

KLV Object class. More...

#include <klvobject.h>

Inheritance diagram for KLVObject:

RefCount IRefCount KLVEObject List of all members.

Public Member Functions

 KLVObject (ULPtr ObjectUL=NULL)
 Build a new KLVObject.
virtual void Init (void)
 Initialise newly built KLVObject.
virtual ~KLVObject ()
virtual void SetSource (MXFFilePtr File, Position Location=-1)
 Set the source details when an object has been read from a file.
virtual void SetDestination (MXFFilePtr File, Position Location=-1)
 Set the destination details for the object to be written to a file.
virtual ULPtr GetUL (void)
 Get the object's UL.
virtual void SetUL (ULPtr NewUL)
 Set the object's UL.
virtual Position GetLocation (void)
 Get the location within the ultimate parent.
virtual std::string GetSource (void)
 Get text that describes where this item came from.
std::string GetSourceLocation (void)
 Get text that describes exactly where this item came from.
virtual Int32 GetKLSize (void)
 Get the size of the key and length (not of the value).
virtual void SetKLSize (Int32 NewKLSize)
 Set the size of the key and length (not of the value).
virtual GCElementKind GetGCElementKind (void)
 Get a GCElementKind structure.
virtual UInt32 GetGCTrackNumber (void)
 Get the track number of this KLVObject (if it is a GC KLV, else 0).
virtual Position GetDataBase (void)
 Get the position of the first byte in the DataChunk as an offset into the file.
virtual void SetDataBase (Position NewBase)
 Set the position of the first byte in the DataChunk as an offset into the file.
virtual Int32 ReadKL (void)
 Read the key and length for this KLVObject from the current source.
Int32 Base_ReadKL (void)
 Base verion: Read the key and length for this KLVObject from the current source.
virtual size_t ReadData (size_t Size=static_cast< size_t >(-1))
 Read data from the start of the KLV value into the current DataChunk.
virtual size_t ReadDataFrom (Position Offset, size_t Size=static_cast< size_t >(-1))
 Read data from a specified position in the KLV value field into the DataChunk.
size_t Base_ReadDataFrom (Position Offset, size_t Size=static_cast< size_t >(-1))
 Base verion: Read data from a specified position in the KLV value field into the DataChunk.
size_t Base_ReadDataFrom (DataChunk &Buffer, Position Offset, size_t Size=static_cast< size_t >(-1))
 Base verion: Read data from a specified position in the KLV value field into the DataChunk.
virtual Int32 WriteKL (Int32 LenSize=0)
 Write the key and length of the current DataChunk to the destination file.
Int32 Base_WriteKL (Int32 LenSize=0, Length NewLength=-1)
 Base verion: Write the key and length of the current DataChunk to the destination file.
virtual size_t WriteData (size_t Size=static_cast< size_t >(-1))
 Write (some of) the current data to the same location in the destination file.
virtual size_t WriteDataFrom (Position Start, size_t Size=static_cast< size_t >(-1))
 Write (some of) the current data to the same location in the destination file.
virtual size_t WriteDataTo (Position Offset, size_t Size=static_cast< size_t >(-1))
 Write (some of) the current data to a different location in the destination file.
virtual size_t WriteDataFromTo (Position Offset, Position Start, size_t Size=static_cast< size_t >(-1))
 Write (some of) the current data to the same location in the destination file.
virtual size_t WriteDataTo (const UInt8 *Buffer, Position Offset, size_t Size)
 Write data from a given buffer to a given location in the destination file.
size_t Base_WriteDataTo (const UInt8 *Buffer, Position Offset, size_t Size)
 Base verion: Write data from a given buffer to a given location in the destination file.
virtual void SetReadHandler (KLVReadHandlerPtr Handler)
 Set a handler to supply data when a read is performed.
virtual Length GetLength (void)
 Get the length of the value field.
virtual void SetLength (Length NewLength)
 Set the length of the value field.
virtual DataChunkGetData (void)
 Get a reference to the data chunk.

Protected Attributes

KLVInfo Source
 Info on the source file.
KLVInfo Dest
 Info on the destination file.
ULPtr TheUL
 The UL for this object (if known).
Length ValueLength
 Length of the value field.
DataChunk Data
 The raw data for this item (if available).
Position DataBase
 The offset of the first byte in the DataChunk from the start of the KLV value field.
KLVReadHandlerPtr ReadHandler
 A read-handler to supply data in response to read requests. If NULL data will be read from SourceFile (if available).

Friends

class KLVEObject

Classes

class  KLVInfo

Detailed Description

KLV Object class.

This class gives access to single KLV items within an MXFfile. The normal use for this class is handling of essence data. Huge values can be safely handled by loading them a "chunk" at a time. Data is also available to identify the location of the value in an MXFFile so that MXFFile::Read() and MXFFile::Write can be used for efficient access.

Note:
This class does not provide any interlock mechanism to ensure safe concurrent access. So if modified data is held in the object's DataChunk, but not yet written to the file, calls to KLVObject::ReadData() or MXFFile::Read() will return the unmodifief data.


Constructor & Destructor Documentation

KLVObject ( ULPtr  ObjectUL = NULL  ) 

Build a new KLVObject.

virtual ~KLVObject (  )  [inline, virtual]


Member Function Documentation

void Init ( void   )  [virtual]

Initialise newly built KLVObject.

Reimplemented in KLVEObject.

virtual void SetSource ( MXFFilePtr  File,
Position  Location = -1 
) [inline, virtual]

Set the source details when an object has been read from a file.

Parameters:
File The source file of this KLVObject
Location The byte offset of the start of the key of the KLV from the start of the file (current position if -1)

virtual void SetDestination ( MXFFilePtr  File,
Position  Location = -1 
) [inline, virtual]

Set the destination details for the object to be written to a file.

Parameters:
File The destination file of this KLVObject
Location The byte offset of the start of the key of the KLV from the start of the file, if omitted (or -1) the current position in that file will be used

virtual ULPtr GetUL ( void   )  [inline, virtual]

Get the object's UL.

Reimplemented in KLVEObject.

virtual void SetUL ( ULPtr  NewUL  )  [inline, virtual]

Set the object's UL.

Reimplemented in KLVEObject.

virtual Position GetLocation ( void   )  [inline, virtual]

Get the location within the ultimate parent.

std::string GetSource ( void   )  [virtual]

Get text that describes where this item came from.

Reimplemented in KLVEObject.

std::string GetSourceLocation ( void   )  [inline]

Get text that describes exactly where this item came from.

virtual Int32 GetKLSize ( void   )  [inline, virtual]

Get the size of the key and length (not of the value).

Reimplemented in KLVEObject.

virtual void SetKLSize ( Int32  NewKLSize  )  [inline, virtual]

Set the size of the key and length (not of the value).

This will be used when writing to the destination (if possible) - you cannot change the "source" KLSize

virtual GCElementKind GetGCElementKind ( void   )  [inline, virtual]

Get a GCElementKind structure.

Reimplemented in KLVEObject.

virtual UInt32 GetGCTrackNumber ( void   )  [inline, virtual]

Get the track number of this KLVObject (if it is a GC KLV, else 0).

Reimplemented in KLVEObject.

virtual Position GetDataBase ( void   )  [inline, virtual]

Get the position of the first byte in the DataChunk as an offset into the file.

Returns:
-1 if the data has not been read from a file (or the offset cannot be determined)

virtual void SetDataBase ( Position  NewBase  )  [inline, virtual]

Set the position of the first byte in the DataChunk as an offset into the file.

Note:
This function must be used with great care as data may will be written to this location

virtual Int32 ReadKL ( void   )  [inline, virtual]

Read the key and length for this KLVObject from the current source.

Returns:
The number of bytes read (i.e. KLSize)

Reimplemented in KLVEObject.

Int32 Base_ReadKL ( void   ) 

Base verion: Read the key and length for this KLVObject from the current source.

Returns:
The number of bytes read (i.e. KLSize)
DRAGONS: This base function may be called from derived class objects to get base behaviour. It is therefore vital that the function does not call any "virtual" KLVObject functions, directly or indirectly.

virtual size_t ReadData ( size_t  Size = static_cast<size_t>(-1)  )  [inline, virtual]

Read data from the start of the KLV value into the current DataChunk.

Parameters:
Size Number of bytes to read, if -1 all available bytes will be read (which could be billions!)
Returns:
The number of bytes read

Reimplemented in KLVEObject.

virtual size_t ReadDataFrom ( Position  Offset,
size_t  Size = static_cast<size_t>(-1) 
) [inline, virtual]

Read data from a specified position in the KLV value field into the DataChunk.

Parameters:
Offset Offset from the start of the KLV value from which to start reading
Size Number of bytes to read, if -1 all available bytes will be read (which could be billions!)
Returns:
The number of bytes read

Reimplemented in KLVEObject.

size_t Base_ReadDataFrom ( Position  Offset,
size_t  Size = static_cast<size_t>(-1) 
) [inline]

Base verion: Read data from a specified position in the KLV value field into the DataChunk.

Parameters:
Offset Offset from the start of the KLV value from which to start reading
Size Number of bytes to read, if -1 all available bytes will be read (which could be billions!)
Returns:
The number of bytes read
DRAGONS: This base function may be called from derived class objects to get base behaviour. It is therefore vital that the function does not call any "virtual" KLVObject functions, directly or indirectly.

size_t Base_ReadDataFrom ( DataChunk Buffer,
Position  Offset,
size_t  Size = static_cast< size_t >(-1) 
)

Base verion: Read data from a specified position in the KLV value field into the DataChunk.

Parameters:
Offset Offset from the start of the KLV value from which to start reading
Size Number of bytes to read, if -1 all available bytes will be read (which could be billions!)
Returns:
The number of bytes read
Note:
This function can write to a buffer other than the KLVObject's main buffer if required, however the file pointer will be updated so care must be used when mixing reads
DRAGONS: This base function may be called from derived class objects to get base behaviour. It is therefore vital that the function does not call any "virtual" KLVObject functions, directly or indirectly.

virtual Int32 WriteKL ( Int32  LenSize = 0  )  [inline, virtual]

Write the key and length of the current DataChunk to the destination file.

The key and length will be written to the source file as set by SetSource. If LenSize is zero the length will be formatted to match KLSize (if possible!)

Reimplemented in KLVEObject.

Int32 Base_WriteKL ( Int32  LenSize = 0,
Length  NewLength = -1 
)

Base verion: Write the key and length of the current DataChunk to the destination file.

The key and length will be written to the source file as set by SetSource. If LenSize is zero the length will be formatted to match KLSize (if possible!). The length written can be overridden by using parameter NewLength

DRAGONS: This base function may be called from derived class objects to get base behaviour. It is therefore vital that the function does not call any "virtual" KLVObject functions, directly or indirectly.

virtual size_t WriteData ( size_t  Size = static_cast<size_t>(-1)  )  [inline, virtual]

Write (some of) the current data to the same location in the destination file.

Parameters:
Size The number of bytes to write, if -1 all available bytes will be written
Returns:
The number of bytes written

Reimplemented in KLVEObject.

virtual size_t WriteDataFrom ( Position  Start,
size_t  Size = static_cast<size_t>(-1) 
) [inline, virtual]

Write (some of) the current data to the same location in the destination file.

Parameters:
Start The offset within the current DataChunk of the first byte to write
Size The number of bytes to write, if -1 all available bytes will be written
Returns:
The number of bytes written

Reimplemented in KLVEObject.

virtual size_t WriteDataTo ( Position  Offset,
size_t  Size = static_cast<size_t>(-1) 
) [inline, virtual]

Write (some of) the current data to a different location in the destination file.

Parameters:
Offset The offset within the KLV value field of the first byte to write
Size The number of bytes to write, if <= 0 all available bytes will be written
Returns:
The number of bytes written

Reimplemented in KLVEObject.

virtual size_t WriteDataFromTo ( Position  Offset,
Position  Start,
size_t  Size = static_cast<size_t>(-1) 
) [inline, virtual]

Write (some of) the current data to the same location in the destination file.

Parameters:
Offset The offset within the KLV value field of the first byte to write
Start The offset within the current DataChunk of the first byte to write
Size The number of bytes to write, if -1 all available bytes will be written
Returns:
The number of bytes written

Reimplemented in KLVEObject.

virtual size_t WriteDataTo ( const UInt8 Buffer,
Position  Offset,
size_t  Size 
) [inline, virtual]

Write data from a given buffer to a given location in the destination file.

Parameters:
Buffer Pointer to data to be written
Offset The offset within the KLV value field of the first byte to write
Size The number of bytes to write
Returns:
The number of bytes written
Note:
As there may be a need for the implementation to know where within the value field this data lives, there is no WriteData(Buffer, Size) function.

Reimplemented in KLVEObject.

size_t Base_WriteDataTo ( const UInt8 Buffer,
Position  Offset,
size_t  Size 
)

Base verion: Write data from a given buffer to a given location in the destination file.

Parameters:
Buffer Pointer to data to be written
Offset The offset within the KLV value field of the first byte to write
Size The number of bytes to write
Returns:
The number of bytes written
DRAGONS: This base function may be called from derived class objects to get base behaviour. It is therefore vital that the function does not call any "virtual" KLVObject functions, directly or indirectly.

virtual void SetReadHandler ( KLVReadHandlerPtr  Handler  )  [inline, virtual]

Set a handler to supply data when a read is performed.

Note:
If not set it will be read from the source file (if available) or cause an error message

virtual Length GetLength ( void   )  [inline, virtual]

Get the length of the value field.

Note:
If not set it will be written to destination file (if available) or cause an error message

Reimplemented in KLVEObject.

virtual void SetLength ( Length  NewLength  )  [inline, virtual]

Set the length of the value field.

Reimplemented in KLVEObject.

virtual DataChunk& GetData ( void   )  [inline, virtual]

Get a reference to the data chunk.


Friends And Related Function Documentation

friend class KLVEObject [friend]


Member Data Documentation

KLVInfo Source [protected]

Info on the source file.

KLVInfo Dest [protected]

Info on the destination file.

ULPtr TheUL [protected]

The UL for this object (if known).

Length ValueLength [protected]

Length of the value field.

DataChunk Data [protected]

The raw data for this item (if available).

Position DataBase [protected]

The offset of the first byte in the DataChunk from the start of the KLV value field.

KLVReadHandlerPtr ReadHandler [protected]

A read-handler to supply data in response to read requests. If NULL data will be read from SourceFile (if available).


The documentation for this class was generated from the following files:
Generated on Mon Apr 2 15:20:59 2007 for MXFLib by  doxygen 1.5.1-p1