// $Revision: 1.4 $ // Copyright (C) 1994-1995 Taligent, Inc. All rights reserved. #ifndef TaligentSamples_SENDERCALLER #include "SenderCaller.h" #endif #ifndef Taligent_MESSAGESTREAMSTRANSPORT #include #endif MRemoteCallerDefinitionsMacro(TSenderCaller); TSenderCaller::TSenderCaller() : MRemoteCaller(), MRemoteCallerNotifier(this), MSenderProtocol(), fLock() { MRemoteCallerEnable(); } TSenderCaller::TSenderCaller(TMessageStreamsTransport* transport) : MRemoteCaller(transport), MRemoteCallerNotifier(this), MSenderProtocol(), fLock() { MRemoteCallerEnable(); } TSenderCaller::~TSenderCaller() { } long TSenderCaller::GetValue() const { // Cast away const TSenderCaller* nonConstThis = (TSenderCaller*)this; TMonitorEntry entry(&nonConstThis->fLock); nonConstThis->BeginRequest(kGetValue); long result = 0; try { result <<= *nonConstThis->SendRequest(); nonConstThis->EndRequest(); } catch (const TRemoteCallException&) { qprintf("Remote call failed.\n"); } return result; } void TSenderCaller::SetValue(long value) { TMonitorEntry entry(&fLock); value >>= *BeginRequest(kSetValue); try { SendRequest(); EndRequest(); } catch (const TRemoteCallException&) { qprintf("Remote call failed.\n"); } } TInterest TSenderCaller::GetValueChangedInterest() const { static const TToken kValueChanged("ValueChanged"); // Cast away const. return TInterest((TSenderCaller*)this, kValueChanged); }