如何编写CORBA VMS的方法
CORBA VMS how to write the method?
我正在学习用CORBA编写一个数字媒体管理程序。我不知道如何实现方法VMSgetMediaAvailable()引发(ServerException)。
VMS.idl:
module VMS {
enum Genre { g_undefined, SciFi, Comedy, Action, Horror, Docu };
enum StatusType { s_undefined, available, lent };
struct VMSMedia {
long ObjectId;
long ProviderId;
Genre Type;
string Title;
string ProductionCountry;
short ProductionYear;
short Length;
StatusType Status;
};
struct VMSProvider {
long ObjectId;
string Name;
string FirstName;
long ZIPCode; /* short does not work */
string Address;
};
exception ServerException {
string reason;
};
typedef sequence<VMSMedia> VMSMediaSeq;
typedef sequence<VMSProvider> VMSProviderSeq;
interface VMSRepository {
readonly attribute long currentMaxProviderId;
readonly attribute long currentMaxMediaId;
oneway void save ();
oneway void addProvider (in VMSProvider p);
oneway void delProvider (in long id);
VMSProvider getProvider (in long id)
raises (ServerException);
VMSProviderSeq getProviders ()
raises (ServerException);
oneway void addMedia (in VMSMedia p);
oneway void delMedia (in long id);
VMSMedia getMedia (in long id)
raises (ServerException);
VMSMediaSeq getMediaOfType (in Genre type)
raises (ServerException);
VMSMediaSeq getMediaYoungerThan (in short year)
raises (ServerException);
//here new Method
VMSMediaSeq getMediaAvailable () raises
(ServerException);
};
};
我所拥有的就是在类Repository_i.cc:
void
VMSRepository_i::VMSMediaSeq getMediaAvailable () {
}
我知道我必须在那个IDL文件中创建一个新的Stub和一个新的Skelton,我必须实现这个方法。我需要问是否有可用的媒体,所以我必须做一个if- Statement对吗?但是我不知道我该怎么做。
getMediaAvailable()
的实现将需要填充
的序列struct VMSMedia
。您必须使用OS/库调用来查找可用的序列并填充序列。
搜索一下如何在CORBA中填充序列,这并不难。
相关文章:
- 为不同配置设置MSVC_RUNTIME_LIBRARY的正确方法是什么
- 通过方法访问结构
- 最小硬币更换问题(自上而下方法)
- C++为构建时间获取QDateTime的可靠方法
- 在C#中处理C++指针而不使用unsafe的最佳方法
- 处理多个异常集合的C++方法
- 如果C++类在类方法中具有动态分配,但没有构造函数/析构函数或任何非静态成员,那么它仍然是POD类型吗
- 有什么方法可以遍历结构吗
- 当类在C++中定义时,有什么方法可以"register"类吗?
- 在C++中,将大的无符号浮点数四舍五入为整数的最佳方法是什么
- 实现无开销push_back的最佳方法是什么
- 使用std::函数映射对象方法
- 有符号的int和int-有没有一种方法可以在C++中区分它们
- C++从另一个类访问公共静态向量的正确方法是什么
- C++优先级队列,按对象的唯一指针的特定方法升序排列
- 没有为自己的结构调用列表推回方法
- 有没有什么方法可以使用一个函数中定义的常量变量,也可以由c++中同一程序中的其他函数使用
- 在类定义之后定义一个私有方法
- 枚举环境变量的惯用C++14/C++17方法
- 如何编写CORBA VMS的方法