
//	Title:		Signal.cpp
//	Purpose:	Contains all Signal related code.

#include <iostream>
#include <string.h>
#include <vector>
#include <list>
using namespace std;
#include "Signal.h" 


// CSignal

CSignal::CSignal(void)
{
	cout << " CSignal::CSignal()\n";

	signal_name = new char[32];					// allocate space for signal_name
	strcpy(signal_name, "actual_signal_name");	// copy actual signal name into the var signal_name
}

CSignal::~CSignal(void)
{
	cout << " CSignal::~CSignal()\n";
}

char *CSignal::GetName(void)
{
	cout << " CSignal::GetName()\n";

	return signal_name;
}


// CDoubleSignal

CDoubleSignal::CDoubleSignal(void)
{
	cout << " CDoubleSignal::CDoubleSignal()\n";

	var = 0.0;	// init double signal to zero.
}

CDoubleSignal::~CDoubleSignal(void)
{
	cout << " CDoubleSignal::~CDoubleSignal()\n";
}


// CMatrixSignal

CMatrixSignal::CMatrixSignal(void)
{
	cout << " CMatrixSignal::CMatrixSignal()\n";

	nrows = 0;
	ncols = 0;
	matrix_signal = NULL;	// init matrix_signal ptr to NULL (allocate memory for this elsewhere)
}	

CMatrixSignal::~CMatrixSignal(void)
{
	cout << " CMatrixSignal::~CMatrixSignal()\n";
}	


// CVectorSignal

CVectorSignal::CVectorSignal(void)
{
	cout << " CVectorSignal::CVectorSignal()\n";

	length = 0;
	vector_signal = NULL;	// init vector_signal ptr to NULL (allocate memory for this elsewhere)
}

CVectorSignal::~CVectorSignal(void)
{
	cout << " CVectorSignal::~CVectorSignal()\n";
}


// CConnection 

CConnection::CConnection(void)
{
	cout << " CConnection::CConnection()\n";

	start_pt[0] = 0.0;				// start pt. (x,y) ordered pair: x cmpt.
	start_pt[1] = 0.0;				// start pt. (x,y) ordered pair: y_cmpt.
	end_pt[0] = 1.0;				// end pt. (x,y) ordered pair: x_cmpt.
	end_pt[1] = 1.0;				// end pt. (x,y) ordered pair: y_cmpt.
	m_pRefFromPort = NULL;			// from-port ref.
	m_pRefToPort = NULL;			// to-port ref.
	m_pSignal = new CDoubleSignal;	// contained ptr-to-CSignal init. to NULL.
}

CConnection::~CConnection(void)
{
	cout << " CConnection::~CConnection()\n";
}

CSignal *CConnection::GetSignal(void)
{
	cout << " CConnection::GetSignal()\n";

	return m_pSignal;	// return private member var signal of type ptr-to-CSignal
}
