/usr/include/sipxtapi/utl/UtlRscStore.h is in libsipxtapi-dev 3.3.0~test17-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | //
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef _UtlRscStore_h_
#define _UtlRscStore_h_
#include "utl/UtlRscTrace.h"
#ifdef RSC_TEST
// SYSTEM INCLUDES
#include "os/OsDefs.h"
#include "os/OsBSem.h"
#include "os/OsRWMutex.h"
#include "os/OsStatus.h"
// APPLICATION INCLUDES
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// STRUCTS
// TYPEDEFS
// FORWARD DECLARATIONS
class UtlRscTrace;
//:Database of active Rscs.
// The UtlRscStore maintains a database of active Rscs (i.e., those Rscs
// that have been started by the low level OsSysRsc class). Since the
// OsRscTask is the only task that should be accessing the Rsc database
// there is no need to serialize access (and no locking).<br>
// <br>
// Each entry in the database is a key/value pair where the key corresponds
// to a Rsc ID and the value is the pointer to the corresponding OsRsc
// object. Duplicate keys are not allowed.
class UtlRscStore
{
friend UtlRscTrace;
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
enum StoreInitSize { RSC_STORE_INIT_SIZE = 1000000 };
/* ============================ CREATORS ================================== */
UtlRscStore(int initialStoreSize = RSC_STORE_INIT_SIZE);
//:Default constructor
virtual
~UtlRscStore();
//:Destructor
/* ============================ MANIPULATORS ============================== */
OsStatus insert(int RscId, char* pRsc);
//:Insert the indicated Rsc into the database of active Rscs.
// Return OS_SUCCESS if successful, OS_NAME_IN_USE if the key is
// already in the database.
OsStatus remove(int RscId);
//:Remove the indicated Rsc from the database of active Rscs.
// Return OS_SUCCESS if the indicated RscId is found, return
// OS_NOT_FOUND if there is no match for the specified key.
void cleanUp();
/* ============================ ACCESSORS ================================= */
int getActiveRscs(char* activeRscs[], int size);
//:Get an array of pointers to the Rscs that are currently active.
// The caller provides an array that can hold up to <i>size</i> OsRsc
// pointers. This method will fill in the <i>activeRscs</i> array with
// up to <i>size</i> pointers. The method returns the number of pointers
// in the array that were actually filled in.
void getStoreStats(unsigned& nInserts, unsigned& nRemoves) const;
//:Get the number of insertions and removals for the Rsc database.
int numEntries(void) const;
//:Return the number of key-value pairs in the name database.
/* ============================ INQUIRY =================================== */
UtlBoolean isEmpty(void) const;
//:Return TRUE if the Rsc database is empty.
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
UtlHashMap mDict; // hash table used to store the key/value
// pairs
unsigned long mNumInserts; // number of insertions into the database
unsigned long mNumRemoves; // number of removals from the database
OsRWMutex mDictRWLock;
UtlRscStore(const UtlRscStore& rUtlRscStore);
//:Copy constructor (not implemented for this class)
UtlRscStore& operator=(const UtlRscStore& rhs);
//:Assignment operator (not implemented for this class)
#ifdef TEST
static bool sIsTested;
//:Set to true after the tests for this class have been executed once
void test();
//:Verify assertions for this class
// Test helper functions
void testCreators();
void testManipulators();
void testAccessors();
void testInquiry();
#endif TEST
};
/* ============================ INLINE METHODS ============================ */
#endif // RSC_TEST
#endif // _UtlRscStore_h_
|