sipxmedialib  Version 3.3
MpResourceFactory.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006-2015 SIPfoundry Inc. All rights reserved.
3 //
4 //
5 // $$
7 
8 // Author: Dan Petrie <dpetrie AT SIPez DOT com>
9 
10 #ifndef _MpResourceFactory_h_
11 #define _MpResourceFactory_h_
12 
13 // SYSTEM INCLUDES
14 #include <os/OsStatus.h>
15 #include <utl/UtlString.h>
16 #include <utl/UtlHashMap.h>
17 
18 // APPLICATION INCLUDES
19 // DEFINES
20 #define DEFAULT_BRIDGE_RESOURCE_TYPE "MprBridge"
21 #define DEFAULT_FROM_FILE_RESOURCE_TYPE "MprFromFile"
22 #define DEFAULT_FROM_INPUT_DEVICE_RESOURCE_TYPE "MprFromInputDevice"
23 #define DEFAULT_TONE_GEN_RESOURCE_TYPE "MprToneGen"
24 #define DEFAULT_TO_OUTPUT_DEVICE_RESOURCE_TYPE "MprToOutputDevice"
25 #define DEFAULT_TO_OUTPUT_DEVICE_WITH_AEC_RESOURCE_TYPE "MprToOutputDevice+Aec"
26 #define DEFAULT_SPEEX_PREPROCESS_RESOURCE_TYPE "MprSpeexPreprocess"
27 #define DEFAULT_NULL_RESOURCE_TYPE "MprNull"
28 #define DEFAULT_HOOK_RESOURCE_TYPE "MprHook"
29 #define DEFAULT_RTP_INPUT_RESOURCE_TYPE "MpRtpInputConnection"
30 #define DEFAULT_MCAST_RTP_INPUT_RESOURCE_TYPE "MpMcastRtpInputConnection"
31 #define DEFAULT_DECODE_RESOURCE_TYPE "MprDecode"
32 #define DEFAULT_RTP_OUTPUT_RESOURCE_TYPE "MpRtpOutputConnection"
33 #define DEFAULT_ENCODE_RESOURCE_TYPE "MprEncode"
34 #define DEFAULT_RECORDER_RESOURCE_TYPE "MprRecorder"
35 #define DEFAULT_SPLITTER_RESOURCE_TYPE "MprSplitter"
36 #define DEFAULT_NULL_AEC_RESOURCE_TYPE "MprNullAec"
37 #define DEFAULT_VAD_RESOURCE_TYPE "MprVad"
38 #define DEFAULT_VOICE_ACTIVITY_NOTIFIER_RESOURCE_TYPE "MprVoiceActivityNotifier"
39 #define DEFAULT_DELAY_RESOURCE_TYPE "MprDelay"
40 #define DEFAULT_SPEAKER_SELECTOR_RESOURCE_TYPE "SpeakerSelector"
41 #define DEFAULT_TONE_DETECT_RESOURCE_TYPE "MprToneDetect"
42 #define DEFAULT_NOTCH_FILTER_RESOURCE_TYPE "MprNotchFilter"
43 // MACROS
44 // EXTERNAL FUNCTIONS
45 // EXTERNAL VARIABLES
46 // CONSTANTS
47 // STRUCTS
48 // TYPEDEFS
49 // FORWARD DECLARATIONS
51 class MpResource;
52 
62 {
63 /* //////////////////////////// PUBLIC //////////////////////////////////// */
64 public:
65 
66 /* ============================ CREATORS ================================== */
67 
71 
74  virtual ~MpResourceFactory();
75 
76 /* ============================ MANIPULATORS ============================== */
77 
79  OsStatus addConstructor(MpResourceConstructor& resourceConstructor);
80 
82  OsStatus newResource(const UtlString& resourceType,
83  const UtlString& newResourceName,
84  int maxResourcesToCreate,
85  int& numResourcesCreated,
86  MpResource* resourcesCreated[]) const;
101 /* ============================ ACCESSORS ================================= */
102 
103 /* ============================ INQUIRY =================================== */
104 
105  UtlBoolean constructorExists(const UtlString& resourceType);
106 
107 /* //////////////////////////// PROTECTED ///////////////////////////////// */
108 protected:
109 
110 /* //////////////////////////// PRIVATE /////////////////////////////////// */
111 private:
112 
113 
116  MpResourceFactory(const MpResourceFactory& rMpResourceFactory);
117 
118 
122 
123 
124  UtlHashMap mConstructors;
125 };
126 
127 /* ============================ INLINE METHODS ============================ */
128 
129 #endif // _MpResourceFactory_h_
OsStatus newResource(const UtlString &resourceType, const UtlString &newResourceName, int maxResourcesToCreate, int &numResourcesCreated, MpResource *resourcesCreated[]) const
Create a new resource of given type.
Definition: MpResourceFactory.cpp:59
MpResourceFactory & operator=(const MpResourceFactory &rhs)
MpResourceConstructor is used to construct a spcific resource type.
Definition: MpResourceConstructor.h:36
MpResourceFactory is used to construct resources by type name.
Definition: MpResourceFactory.h:61
MpResourceFactory()
Definition: MpResourceFactory.cpp:29
UtlHashMap mConstructors
Definition: MpResourceFactory.h:124
UtlBoolean constructorExists(const UtlString &resourceType)
Definition: MpResourceFactory.cpp:80
OsStatus addConstructor(MpResourceConstructor &resourceConstructor)
Add a constructor for a new resource type.
Definition: MpResourceFactory.cpp:40
Abstract base class for all media processing objects.
Definition: MpResource.h:56
virtual ~MpResourceFactory()
Definition: MpResourceFactory.cpp:34