// Note: Instrumentation statements are highlighted in green 

#include <vobject.hpp>
#pragma hdrstop
#include "guitar_string.hpp"

///////////////////////////////////////////////////////////////////////////////
// GuitarString
///////////////////////////////////////////////////////////////////////////////

// Visual Member Definition 
VISIBILITY_START(GuitarString, "GuitarString", 0)
VVARIABLE(GuitarString, openNote, "Open note", 0, 0)
VVARIABLE(GuitarString, yPosition, "Position", 0, 0)
VISIBILITY_END

GuitarString::GuitarString(void) :
  yPosition(25)
{
}

GuitarString::GuitarString(Note & note, unsigned short y_position) :
  openNote(note),
  yPosition(y_position)
{
}

GuitarString::~GuitarString(void)
{
}

GuitarString::GuitarString(const GuitarString &note)
{
  *this = note;
}

GuitarString & GuitarString::operator=(const GuitarString &g_string)
{
  openNote = g_string.openNote;
  yPosition = g_string.yPosition;
  return *this;
}

bool GuitarString::operator==(const GuitarString &g_string) const
{
  return openNote == g_string.openNote;
}

///////////////////////////////////////////////////////////////////////////////
// GuitarStringTable
///////////////////////////////////////////////////////////////////////////////

// Visual Member Definition 
VISIBILITY_START(GuitarStringTable, "GuitarStringTable", 0)
VVCONTAINER(GuitarStringTable, guitarStringTable, "Guitar String Table", 0, 0)
VISIBILITY_END

GuitarStringTable::GuitarStringTable(void)
{
}

GuitarStringTable::~GuitarStringTable(void)
{
}

GuitarStringTable::GuitarStringTable(const GuitarStringTable & guitar_string_table)
{
  *this = guitar_string_table;
}

GuitarStringTable & GuitarStringTable::operator=(const GuitarStringTable & guitar_string_table)
{
  guitarStringTable.erase(guitarStringTable.begin(), guitarStringTable.end()) ;
  GuitarStringVector::const_iterator guitar_string_iter = guitar_string_table.guitarStringTable.begin();
  while (guitar_string_iter != guitar_string_table.guitarStringTable.end()) {
    guitarStringTable.push_back(*guitar_string_iter);
    guitar_string_iter++;
  }
  return *this;
}

void GuitarStringTable::addString(GuitarString & a_string)
{
  guitarStringTable.push_back(a_string);
}

GuitarStringVector::iterator GuitarStringTable::GetGuitarStringTableIterator(char * guitar_string_name)
{
  Note note("", guitar_string_name, 0, 0);
  return std::find(guitarStringTable.begin(), guitarStringTable.end(), GuitarString(note, 0));
}

GuitarString * GuitarStringTable::GetGuitarString(char * guitar_string_name)
{
  Note note("", guitar_string_name, 0, 0);
  GuitarStringVector::iterator guitar_string_iter = std::find(guitarStringTable.begin(), guitarStringTable.end(), GuitarString(note, 0));
  if (guitar_string_iter != guitarStringTable.end())
    return &(*guitar_string_iter);
  else
    return NULL;
}


Copyright 2002-2007 Outerface Technologies, Inc.