/*! \file
Project: Device Interface
Copyright © 2000,2001,2002,2003 All Rights Reserved.
SYSTEM: DVS Type Level
SUBSYSTEM: Generic Dvs Type
FILE: DvsArchive.h
AUTHOR: Gerald P. Wilson
OVERVIEW
========
This file contains the basic specification of the
DVS archive command set handlers.
HISTORY
========
17Mar03 wilson Created
*/
#ifndef DVSARCHIVE_H
#define DVSARCHIVE_H
/* Includes */
#include
#include
#include
/*! \class DvsArchiveCmdDataEle DvsArchive.h DvsArchiveExt.h
\brief A DlList element class.
The DlList (double linked list) class is a template class that
requires the list elements to be defined as a data class.
The data element class defines the contents of the list.
*/
class DvsArchiveCmdDataEle
{
public:
private:
bool valid;
ARCHIVE_CMD_DATA_ST info;
DvsClipUtl util;
public:
DvsArchiveCmdDataEle(void);
bool operator ! (void) const { return ((valid) ? FALSE : TRUE); }
bool Valid(void) const { return (valid); }
void operator = (ARCHIVE_CMD_DATA_ST& rData);
void operator = (DvsArchiveCmdDataEle& rEle);
void Clear(void);
void ClearMask(void) { info.valid = 0; }
bool Validate(void);
void IfJobId(int id);
void DevioJobId(int id);
void DeviceJobId(int id);
void Op(DvsArchiveCmdOpEtype op);
void Source(const String host);
void Source(const char* host);
void Destination(const String host);
void Destination(const char* host);
bits32 ValidMask(void) const { return info.valid; }
bool ValidIfJobId(void) const { return (info.valid & IF_JOB_ID); }
bool ValidDevioJobId(void) const { return (info.valid & DEVIO_JOB_ID); }
bool ValidDeviceJobId(void) const { return (info.valid & DEV_JOB_ID); }
bool DeviceJobIdIsNum(void) const { return info.deviceJIdNum; }
bool ValidOpCode(void) const { return (info.valid & OP_INFO_ID); }
bool ValidSrc(void) const { return (info.valid & SRC_ID); }
bool ValidDest(void) const { return (info.valid & DEST_ID); }
bool ValidStatus(void) const { return (info.valid & STATUS_MSG_ID); }
bool ValidMsg(void) const { return (info.valid & GENERIC_MSG_ID); }
bool ValidClip(void) const { return (info.valid & CLIP_INFO_ID); }
int JobState(void) const { return info.state; }
void JobState(DvsArchiveJobStateOpEtype s) { info.state = s; }
int IfJobId(void) const;
int DevioJobId(void) const;
int DeviceJobId(void) const;
const char* DeviceJobIdStr(void) const;
int Op(void) const;
const char* Src(void) const;
const char* Dest(void) const;
const char* Status(void) const;
const char* Msg(void) const;
CLIP_INFO_ST* Clip(void) { return &info.clip; }
void ClipName(const char *pName) { util.Name(info.clip, pName); }
const char* ClipName(void) { return(info.clip.name); }
ARCHIVE_CMD_DATA_ST& Data(void) { return info; }
};
/*! \fn bool DvsArchiveCmdDataEle::operator ! (void) const
* \brief Validity test.
* \return The logical expression "object is not valid".
*/
/*! \fn bool DvsArchiveCmdDataEle::Valid(void) const
* \brief Validity test.
* \return The logical expression "object is valid".
*/
/*! \typedef DlList ArchiveDataEle;
* \brief Hide the template notation and simplify the element name
*/
typedef DlList ArchiveDataEle;
/*! \class DvsArchiveCmdList DvsArchive.h DvsArchiveExt.h
\brief A double linked list class for queueing DVS archive commands.
The DvsArchiveCmdList class is a double linked list that stores archive
work procedures initated by host automation systems. It acts as a smart
FIFO of command procedures, able to throtle the work load, add and delete
commands, etc.
*/
class DvsArchiveCmdList
{
private:
bool valid; //!< Standard validity flag
int ecount; //!< Number of elements to allocate at a time
ArchiveDataEle list; //!< Dummy element acting as the list head
int opid; //!< Operation ID source
int limit; //!< Limit of consecutive operations
int no_active; //!< Number of operations in progress
AllocEle::EleSt **pActive; //!< List of operations in progress
DvsArchiveCmdDataEle notFound; //!< Dummy element used as default return value
public:
DvsArchiveCmdList(int num_ele=10, int lim=5);
bool operator ! (void) const { return ((valid) ? FALSE : TRUE); }
bool IsValid(void) const { return valid; }
int Add(ARCHIVE_CMD_DATA_ST& rData);
int Delete(int id);
int NumPendingOps(void) const { return no_active; }
void SetLimit(int l);
int Limit(void) { return limit; }
int NumEle(void);
void Clear();
DvsArchiveCmdDataEle& Find(int id);
int Find(ARCHIVE_CMD_DATA_ST& info);
AllocEle::EleSt* ActiveOp(int i);
AllocEle::EleSt* NextOp(void);
void CompleteOp(AllocEle::EleSt* op);
private:
void returnEle(AllocEle::EleSt *pDeleted);
};
/*! \fn int DvsArchiveCmdList::NumPendingOps(void) const
* \brief Get the number of operations in progress.
* \return The number of operations in progress.
*/
/*! \fn bool DvsArchiveCmdList::operator ! (void) const
* \brief Validity test.
* \return The logical expression "object is not valid".
*/
/*! \fn bool DvsArchiveCmdList::IsValid(void) const
* \brief Validity test.
* \return The logical expression "object is valid".
*/
/*! \fn inline int DvsArchiveCmdList::NumEle(void)
* \brief Return the number of active jobs.
*/
inline int DvsArchiveCmdList::NumEle(void) { return list.Count(); }
/*! \fn inline void DvsArchiveCmdList::Clear(void)
* \brief Remove all active jobs.
*/
inline void DvsArchiveCmdList::Clear(void) { list.Clear(); }
#pragma library(DvsArchive)
#endif /* End DVSARCHIVE_H Sentry */