Fixing bad mering and test for search manager

This commit is contained in:
Gasper Jansa
2011-01-10 23:06:46 +01:00
parent a5f44c97c2
commit b3fb43800f
3 changed files with 341 additions and 12 deletions

View File

@@ -6,12 +6,341 @@
using namespace epics::pvData;
using namespace epics::pvAccess;
//TODO this will be deleted
class ChannelImpl;
class ContextImpl : public Context
{
private:
Timer* _timer;
public:
ContextImpl()
{
_timer = new Timer("krneki",lowPriority);
}
virtual Version* getVersion() {
return NULL;
}
virtual ChannelProvider* getProvider() {
return NULL;
}
Timer* getTimer()
{
return _timer;
}
virtual void initialize() {
}
virtual void printInfo() {
}
virtual void printInfo(epics::pvData::StringBuilder out) {
}
virtual void destroy()
{
}
virtual void dispose()
{
}
BlockingUDPTransport* getSearchTransport()
{
return NULL;
}
/**
* Searches for a channel with given channel ID.
* @param channelID CID.
* @return channel with given CID, <code></code> if non-existent.
*/
Channel* getChannel(pvAccessID channelID)
{
return NULL;
}
Configuration* getConfiguration() {return NULL;}
TransportRegistry* getTransportRegistry() {return NULL;}
~ContextImpl() { delete _timer;};
private:
void loadConfiguration() {
}
void internalInitialize() {
}
void initializeUDPTransport() {
}
void internalDestroy() {
}
void destroyAllChannels() {
}
/**
* Check channel name.
*/
void checkChannelName(String& name) {
}
/**
* Check context state and tries to establish necessary state.
*/
void checkState() {
}
/**
* Generate Client channel ID (CID).
* @return Client channel ID (CID).
*/
pvAccessID generateCID()
{
return 0;
}
/**
* Free generated channel ID (CID).
*/
void freeCID(int cid)
{
}
/**
* Get, or create if necessary, transport of given server address.
* @param serverAddress required transport address
* @param priority process priority.
* @return transport for given address
*/
Transport* getTransport(TransportClient* client, osiSockAddr* serverAddress, int minorRevision, int priority)
{
return NULL;
}
/**
* Internal create channel.
*/
// TODO no minor version with the addresses
// TODO what if there is an channel with the same name, but on different host!
Channel* createChannelInternal(String name, ChannelRequester* requester, short priority,
InetAddrVector* addresses) {
return NULL;
}
/**
* Destroy channel.
* @param channel
* @param force
* @throws CAException
* @throws IllegalStateException
*/
void destroyChannel(ChannelImpl* channel, bool force) {
}
/**
* Get channel search manager.
* @return channel search manager.
*/
ChannelSearchManager* getChannelSearchManager() {
return NULL;
}
};
class TestSearcInstance : public BaseSearchInstance
{
public:
TestSearcInstance(string channelName, pvAccessID channelID): _channelID(channelID), _channelName(channelName) {}
pvAccessID getChannelID() { return _channelID;};
string getChannelName() {return _channelName;};
pvAccessID getSearchInstanceID() { return _channelID;};
string getSearchInstanceName() {return _channelName;};
void searchResponse(int8 minorRevision, osiSockAddr* serverAddress) {};
private:
pvAccessID _channelID;
@@ -19,8 +348,8 @@ private:
};
static const int max_channels = 100;
ClientContextImpl* context = new ClientContextImpl();
ChannelSearchManager* manager = new ChannelSearchManager(context);
ContextImpl* context = new ContextImpl();
ChannelSearchManager* manager = new ChannelSearchManager(static_cast<Context*>(context));
TestSearcInstance** chanArray = new TestSearcInstance*[max_channels];
void* testWorker1(void* p)