#ifndef ADD_TO_EVENT_2008_07_02 #define ADD_TO_EVENT_2008_07_02 /** @file AddToEvent.hpp @author Brian Magill @datecreated 7/02/2008 $Date:$ $Revision:$ @copyright (©) Copyright 2008 by GATS Inc. 11864 Canon Blvd., Suite 101, Newport News, VA 23606 All Rights Reserved. No part of this software or publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise without the prior written permission of GATS Inc. @brief template that allows for EventVars to be initially written out or overwritten */ //---------------------------------------------------------------------- // #include "Event.h" template class AddToEvent { private: Event *event; public: AddToEvent():event(0) { } AddToEvent(Event &inEvent): event(&inEvent) { } AddToEvent(AddToEvent const &rhs):event(rhs.event) { } AddToEvent& operator = (AddToEvent const &rhs ) { if (this == &rhs) return *this; event = rhs.event; return *this; } ~AddToEvent() { } void operator() (EventVar & eventVar) { if(event->EventVarExists(eventVar.getName()) ) event->replaceEventVar(eventVar); else event->addEventVar(eventVar); } }; #endif