/* Copyright (c) 2001 RIPE NCC All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* ------------------------------------------------------------------------------- Module Header Filename : TestBox.h Author : Rene Wilhelm Date : 13-AUG-2001 Description : Interface to the configuration data of one testbox. Language Version : C++ OSs Tested : Solaris 2.6, Solaris 8, Debian Linux 2.2 Comments : TestBox objects are most commonly used as building blocks of the TestBoxConfig class, which specficies the configuration of the TTM network (on a given date) Note : targetList is implemented as a list of pointers to existing TestBox objects to avoid recursion problems (if targetList was an array of real objects, each object in targetList would have a targetList of its own, whose elements would also have targetList, etc.) TODO : implement copy and assignment operators to avoid problems caused by deleting objects created by default assignment/copy operations (i.e. freeing memory twice) implement iterator over list of targets to avoid handing out internal targetlist Add more config fields (e.g. geographical location) $Id: TestBox.h,v 1.1 2002/08/09 23:59:40 wilhelm Exp $ ------------------------------------------------------------------------------- */ #ifndef TestBox_included #define TestBox_included #include class TestBox { private: char *name; // Box's name as returned by hostname char *shortname; // abbreviated name, used in naming files uint id; // numeric id used in measurements TestBox **targetList; // Pointers to targets associated with the box int nTargets; // number of targets in list. int listSize; // Size of the list public: TestBox(); // default constructor TestBox(int num, char *label); // special purpose onstructor ~TestBox(); // destructor uint GetId() {return id;} void SetId(int num) {id = num;} char *GetName() {return name;} char *GetShortName() {return shortname;} void SetName(char *label); void AddTarget(TestBox *target); // add one target TestBox **GetTargets(int& numtargets); // get all targets TestBox *FindTargetById(uint targetid); // find target void SetTargets(int numtargets, TestBox **targets); // set all targets }; #endif