blob: bf9a393789ab96b6631415a507cf3df5e1e7a920 [file] [log] [blame] [edit]
//===========================================================================//
// Purpose : Declaration and inline definitions for the TCH_RelativeBlock
// class.
//
// Inline methods include:
// - SetName (required for TCT_SortedNameDynamicVector_c class)
// - GetName (required for TCT_SortedNameDynamicVector_c class)
// - GetCompare (required for TCT_BSearch and TCT_QSort classes)
// - SetBlockName
// - SetVPR_Index, SetVPR_Type
// - SetRelativeMacroIndex, SetRelativeNodeIndex
// - GetBlockName
// - GetVPR_Index, GetVPR_Type
// - GetRelativeMacroIndex, GetRelativeNodeIndex
// - HasRelativeMacroIndex, HasRelativeNodeIndex
// - IsValid
//
//===========================================================================//
//---------------------------------------------------------------------------//
// Copyright (C) 2013 Jeff Rudolph, Texas Instruments (jrudolph@ti.com) //
// //
// Permission is hereby granted, free of charge, to any person obtaining a //
// copy of this software and associated documentation files (the "Software"),//
// to deal in the Software without restriction, including without limitation //
// the rights to use, copy, modify, merge, publish, distribute, sublicense, //
// and/or sell copies of the Software, and to permit persons to whom the //
// Software is furnished to do so, subject to the following conditions: //
// //
// The above copyright notice and this permission notice shall be included //
// in all copies or substantial portions of the Software. //
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS //
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF //
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN //
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, //
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR //
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE //
// USE OR OTHER DEALINGS IN THE SOFTWARE. //
//---------------------------------------------------------------------------//
#ifndef TCH_RELATIVE_BLOCK_H
#define TCH_RELATIVE_BLOCK_H
#include <cstdio>
using namespace std;
#include "TCH_Typedefs.h"
#include "vpr_api.h"
//===========================================================================//
// Purpose : Class declaration
// Author : Jeff Rudolph
//---------------------------------------------------------------------------//
// Version history
// 01/15/13 jeffr : Original
//===========================================================================//
class TCH_RelativeBlock_c
{
public:
TCH_RelativeBlock_c( void );
TCH_RelativeBlock_c( const string& srName,
int vpr_index = -1,
const t_type_descriptor* vpr_type = 0,
size_t relativeMacroIndex = TCH_RELATIVE_MACRO_UNDEFINED,
size_t relativeNodeIndex = TCH_RELATIVE_NODE_UNDEFINED );
TCH_RelativeBlock_c( const char* pszName,
int vpr_index = -1,
const t_type_descriptor* vpr_type = 0,
size_t relativeMacroIndex = TCH_RELATIVE_MACRO_UNDEFINED,
size_t relativeNodeIndex = TCH_RELATIVE_NODE_UNDEFINED );
TCH_RelativeBlock_c( const TCH_RelativeBlock_c& relativeBlock );
~TCH_RelativeBlock_c( void );
TCH_RelativeBlock_c& operator=( const TCH_RelativeBlock_c& relativeBlock );
bool operator<( const TCH_RelativeBlock_c& relativeBlock ) const;
bool operator==( const TCH_RelativeBlock_c& relativeBlock ) const;
bool operator!=( const TCH_RelativeBlock_c& relativeBlock ) const;
void Print( FILE* pfile = stdout, size_t spaceLen = 0 ) const;
void SetName( const string& srName );
void SetName( const char* pszName );
const char* GetName( void ) const;
const char* GetCompare( void ) const;
void SetBlockName( const string& srName );
void SetBlockName( const char* pszName );
void SetVPR_Index( int vpr_index );
void SetVPR_Type( const t_type_descriptor* vpr_type );
void SetRelativeMacroIndex( size_t relativeMacroIndex );
void SetRelativeNodeIndex( size_t relativeNodeIndex );
const char* GetBlockName( void ) const;
int GetVPR_Index( void ) const;
const t_type_descriptor* GetVPR_Type( void ) const;
size_t GetRelativeMacroIndex( void ) const;
size_t GetRelativeNodeIndex( void ) const;
bool HasRelativeMacroIndex( void ) const;
bool HasRelativeNodeIndex( void ) const;
void Reset( void );
bool IsValid( void ) const;
private:
string srName_; // Name asso. with this relative placement block
int vpr_index_; // VPR index asso. with this relative placement block
t_type_descriptor* vpr_type_; // VPR type asso. with this relative placement block
size_t relativeMacroIndex_; // Index to relative macro in relative macro list
size_t relativeNodeIndex_; // Index to relative node in a relative node list
};
//===========================================================================//
// Purpose : Class inline definition(s)
// Author : Jeff Rudolph
//---------------------------------------------------------------------------//
// Version history
// 01/15/13 jeffr : Original
//===========================================================================//
inline void TCH_RelativeBlock_c::SetName(
const string& srName )
{
this->srName_ = srName;
}
//===========================================================================//
inline void TCH_RelativeBlock_c::SetName(
const char* pszName )
{
this->srName_ = TIO_PSZ_STR( pszName );
}
//===========================================================================//
inline const char* TCH_RelativeBlock_c::GetName(
void ) const
{
return( TIO_SR_STR( this->srName_ ));
}
//===========================================================================//
inline const char* TCH_RelativeBlock_c::GetCompare(
void ) const
{
return( TIO_SR_STR( this->srName_ ));
}
//===========================================================================//
inline void TCH_RelativeBlock_c::SetBlockName(
const string& srBlockName )
{
this->srName_ = srBlockName;
}
//===========================================================================//
inline void TCH_RelativeBlock_c::SetBlockName(
const char* pszBlockName )
{
this->srName_ = TIO_PSZ_STR( pszBlockName );
}
//===========================================================================//
inline void TCH_RelativeBlock_c::SetVPR_Index(
int vpr_index )
{
this->vpr_index_ = vpr_index;
}
//===========================================================================//
inline void TCH_RelativeBlock_c::SetVPR_Type(
const t_type_descriptor* vpr_type )
{
this->vpr_type_ = const_cast< t_type_descriptor* >( vpr_type );
}
//===========================================================================//
inline void TCH_RelativeBlock_c::SetRelativeMacroIndex(
size_t relativeMacroIndex )
{
this->relativeMacroIndex_ = relativeMacroIndex;
}
//===========================================================================//
inline void TCH_RelativeBlock_c::SetRelativeNodeIndex(
size_t relativeNodeIndex )
{
this->relativeNodeIndex_ = relativeNodeIndex;
}
//===========================================================================//
inline const char* TCH_RelativeBlock_c::GetBlockName(
void ) const
{
return( TIO_SR_STR( this->srName_ ));
}
//===========================================================================//
inline int TCH_RelativeBlock_c::GetVPR_Index(
void ) const
{
return( this->vpr_index_ );
}
//===========================================================================//
inline const t_type_descriptor* TCH_RelativeBlock_c::GetVPR_Type(
void ) const
{
return( this->vpr_type_ );
}
//===========================================================================//
inline size_t TCH_RelativeBlock_c::GetRelativeMacroIndex(
void ) const
{
return( this->relativeMacroIndex_ );
}
//===========================================================================//
inline size_t TCH_RelativeBlock_c::GetRelativeNodeIndex(
void ) const
{
return( this->relativeNodeIndex_ );
}
//===========================================================================//
inline bool TCH_RelativeBlock_c::HasRelativeMacroIndex(
void ) const
{
return( this->relativeMacroIndex_ != TCH_RELATIVE_MACRO_UNDEFINED ? true : false );
}
//===========================================================================//
inline bool TCH_RelativeBlock_c::HasRelativeNodeIndex(
void ) const
{
return( this->relativeNodeIndex_ != TCH_RELATIVE_NODE_UNDEFINED ? true : false );
}
//===========================================================================//
inline bool TCH_RelativeBlock_c::IsValid(
void ) const
{
return( this->srName_.length( ) ? true : false );
}
#endif