/**
 * @file
 * $Id$
 * $Revision$
 * $Author$
 * $Date$
 *
 * This file is part of The iWear Framework.
 * In particular this file is part of the iWear Database Access Library.
 *
 * The iWear Framework is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by the
 * Free Software Foundation as in version 2 of the License.

 * 
 * The iWear Framework is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * The iWear Framework; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __DCAGDB_H
#define __DCAGDB_H

#ifndef __IWEAR_H
#include <iwear/iwear.h>
#endif

#ifndef __IWPGDB_H
#include <dbclasses/iwpgdb.h>
#endif

#ifndef __CAR_H
#include <iwear_dcag_mark_assistant/car.h>
#endif

//#ifndef __SUBASSEMBLY_H
//#include <iwear_dcag_mark_assistant/subassembly.h>
//#endif

#ifndef __WELDPOINT_H
#include <iwear_dcag_mark_assistant/weldpoint.h>
#endif

#include <vector>

using namespace iwear;
using namespace db;
using namespace dcag;

namespace iwear {
    namespace dcag {

class DcagDb
{
private:
   IWDB* DB;
   bool b_connected;
   
   void connectDB();
   
public:
   DcagDb();
   virtual ~DcagDb();
   
   vector<Car> getAllCars();
   Car getCar(int id);
   string getCarName(int id);
   void addCar(string carname);
   void deleteCar(Car* car);
   void deleteCar(string name);

   Subassembly getSubassembly(int id);
   int getSubassemblyId(string subassemblyname);
   void addSubassembly(Subassembly* subassembly);
   void deleteSubassembly(Subassembly* subassembly);
   
   vector<Weldpoint> getWeldpoints(Subassembly* sa = NULL, Car* car = NULL, int x_from = -1, int x_to = -1, int y_from = -1, int y_to = -1, int z_from = -1, int z_to = -1);
   Weldpoint getWeldpoint(int name);
   void addWeldpoint(Weldpoint* weldpoint);
   void deleteWeldpoint(Weldpoint* weldpoint);
   
   Weldpoint getNextWeldpoint(Weldpoint* actual);
   int getNextWeldpointName(Weldpoint* actual);
   Weldpoint getPreviousWeldpoint(Weldpoint* actual);
   int getPreviousWeldpointName(Weldpoint* actual);
   vector<int> getSelectedWeldpoints(bool marked = false);
   
   void markWeldpoint(int name, bool marked);
};
} // namespace dcag
} // namespace iwear
#endif
