一个ICE的问题,欢迎大家进来探讨!
热爱生活 2011-05-10 12:22:39 icestorm 手册中有个实例。我在实现过程中出现了问题!
C/C++ codemodule rpt{
struct Measurement
{
string tower; // tower id
float windSpeed; // knots
short windDirection; // degrees
float temperature; // degrees Celsius
};
interface Monitor {
void report(Measurement m);
};
};
在实现发布订阅时:
#include <Ice/Ice.h>
#include <IceStorm/IceStorm.h>
#include <Monitor.h>
int main(int argc, char* argv[])
{
…
Ice::ObjectPrx obj = communicator->stringToProxy(
"IceStorm/TopicManager:tcp -p 9999");
IceStorm::TopicManagerPrx topicManager =
IceStorm::TopicManagerPrx::checkedCast(obj);
IceStorm::TopicPrx topic ;
while (!topic){
try {
topic = topicManager->retrieve("Weather");
} catch (const IceStorm::NoSuchTopic&){
Try{
topic = topicManager->create("Weather");
} catch (const IceStorm::TopicExists&){
// Another client created the topic }
}
}
Ice::ObjectPrx pub = topic->getPublisher()->ice_oneway();
MonitorPrx monitor = MonitorPrx::uncheckedCast(pub);
while (true) {
Measurement m = getMeasurement();
monitor->report(m);
}
…
}
IceStorm::TopicPrx topic;
while(!topic) {
try {
topic = topicManager->retrieve("Weather");
} catch (const IceStorm::NoSuchTopic&){
try {
topic = topicManager->create("Weather");
} catch (const IceStorm::TopicExists&) {
// Another client created the topic }
}
}
Ice::ObjectPrx pub = topic->getPublisher()->ice_oneway();
MonitorPrx monitor = MonitorPrx::uncheckedCast(pub);
while (true) {
Measurement m = getMeasurement();
monitor->report(m);
}
对个体m = getMeasurement();出现了错误error C3861: “getMeasurement”: 找不到标识符??
而手册中没有提到这个函数!!怎么解决??
请高手赐教!