2009-11-04 20:46:53 +00:00
|
|
|
/***************/
|
|
|
|
/* netlist.h */
|
|
|
|
/***************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#ifndef _NETLIST_H_
|
|
|
|
#define _NETLIST_H_
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
|
|
|
|
#include "class_libentry.h"
|
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1"
|
|
|
|
|
|
|
|
#define ISBUS 1
|
|
|
|
|
2007-11-10 20:12:00 +00:00
|
|
|
#define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
|
2008-05-28 12:28:47 +00:00
|
|
|
|
2009-07-12 15:29:42 +00:00
|
|
|
#include "class_netlist_object.h"
|
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
/* Id to select netlist type */
|
2008-05-28 12:28:47 +00:00
|
|
|
enum TypeNetForm {
|
2007-11-10 14:35:04 +00:00
|
|
|
NET_TYPE_UNINIT = 0,
|
2007-09-20 21:06:49 +00:00
|
|
|
NET_TYPE_PCBNEW,
|
|
|
|
NET_TYPE_ORCADPCB2,
|
|
|
|
NET_TYPE_CADSTAR,
|
|
|
|
NET_TYPE_SPICE,
|
2007-11-10 20:12:00 +00:00
|
|
|
NET_TYPE_CUSTOM1, /* NET_TYPE_CUSTOM1
|
|
|
|
* is the first id for user netlist format
|
|
|
|
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
|
|
|
|
* is the last id for user netlist format
|
|
|
|
*/
|
2008-05-15 11:20:19 +00:00
|
|
|
NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1 + CUSTOMPANEL_COUNTMAX - 1
|
2008-05-28 12:28:47 +00:00
|
|
|
};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Max pin number per component and footprint */
|
|
|
|
#define MAXPIN 5000
|
|
|
|
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
/* object used in annotation to handle a list of components in schematic
|
|
|
|
* because in a complex hierarchy, a component is used more than once,
|
|
|
|
* and its reference is depending on the sheet path
|
|
|
|
* for the same component, we must create a flat list of components
|
|
|
|
* used in nelist generation, BOM generation and annotation
|
|
|
|
*/
|
|
|
|
class OBJ_CMP_TO_LIST
|
2008-02-12 21:12:46 +00:00
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
private:
|
|
|
|
/// Component reference prefix, without number (for IC1, this is IC) )
|
|
|
|
std::string m_Ref; // it's private, use the accessors please
|
|
|
|
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
public:
|
2009-11-04 20:46:53 +00:00
|
|
|
SCH_COMPONENT* m_RootCmp; // the component in schematic
|
|
|
|
LIB_COMPONENT* m_Entry; // the source component in library
|
|
|
|
int m_Unit; /* Selected part (For multi parts per
|
2010-07-14 13:24:36 +00:00
|
|
|
* package) depending on sheet path */
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH m_SheetPath; /* the sheet path for this component */
|
2009-11-04 20:46:53 +00:00
|
|
|
unsigned long m_TimeStamp; /* unique identification number
|
|
|
|
* depending on sheet path */
|
|
|
|
bool m_IsNew; /* true for not yet annotated
|
|
|
|
* components */
|
|
|
|
wxString* m_Value; /* Component value (same for all
|
|
|
|
* instances) */
|
|
|
|
int m_NumRef; /* Reference number (for IC1, this is
|
|
|
|
* 1) ) depending on sheet path*/
|
|
|
|
int m_Flag; /* flag for computations */
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
public:
|
2008-05-15 11:20:19 +00:00
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
OBJ_CMP_TO_LIST()
|
|
|
|
{
|
2009-07-05 12:09:41 +00:00
|
|
|
m_RootCmp = NULL;
|
|
|
|
m_Entry = NULL;
|
|
|
|
m_Unit = 0;
|
|
|
|
m_TimeStamp = 0;
|
|
|
|
m_IsNew = false;
|
|
|
|
m_Value = NULL;
|
|
|
|
m_NumRef = 0;
|
|
|
|
m_Flag = 0;
|
2008-12-10 16:49:53 +00:00
|
|
|
}
|
|
|
|
|
2010-07-30 21:41:55 +00:00
|
|
|
/* Some accessors which hide the strategy of how the reference is stored,
|
|
|
|
thereby making it easy to change that strategy.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
void SetRef( const wxString& aReference )
|
|
|
|
{
|
|
|
|
m_Ref = CONV_TO_UTF8( aReference );
|
|
|
|
}
|
|
|
|
wxString GetRef() const
|
|
|
|
{
|
|
|
|
return CONV_FROM_UTF8( m_Ref.c_str() );
|
|
|
|
}
|
|
|
|
void SetRefStr( const std::string& aReference )
|
|
|
|
{
|
|
|
|
m_Ref = aReference;
|
|
|
|
}
|
|
|
|
const char* GetRefStr() const
|
|
|
|
{
|
|
|
|
return m_Ref.c_str();
|
|
|
|
}
|
|
|
|
|
2008-12-10 16:49:53 +00:00
|
|
|
|
|
|
|
int CompareValue( const OBJ_CMP_TO_LIST& item ) const
|
|
|
|
{
|
|
|
|
return m_Value->CmpNoCase( *item.m_Value );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int CompareRef( const OBJ_CMP_TO_LIST& item ) const
|
|
|
|
{
|
2010-07-30 21:41:55 +00:00
|
|
|
return m_Ref.compare( item.m_Ref );
|
2008-12-10 16:49:53 +00:00
|
|
|
}
|
|
|
|
|
2009-07-05 12:09:41 +00:00
|
|
|
|
|
|
|
bool IsPartsLocked()
|
2008-12-10 16:49:53 +00:00
|
|
|
{
|
2010-06-24 18:31:43 +00:00
|
|
|
return m_Entry->UnitsLocked();
|
2008-12-10 16:49:53 +00:00
|
|
|
}
|
2008-05-28 12:28:47 +00:00
|
|
|
};
|
|
|
|
|
2007-09-20 21:06:49 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Global Variables */
|
2009-07-12 15:29:42 +00:00
|
|
|
|
|
|
|
// Buffer to build the list of items used in netlist and erc calculations
|
|
|
|
typedef std::vector <NETLIST_OBJECT*> NETLIST_OBJECT_LIST;
|
2009-11-04 20:46:53 +00:00
|
|
|
extern NETLIST_OBJECT_LIST g_NetObjectslist;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
extern bool g_OptNetListUseNames; /* TRUE to use names rather than
|
|
|
|
* net numbers. SPICE netlist only
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* Prototypes: */
|
2009-07-12 15:29:42 +00:00
|
|
|
void FreeNetObjectsList( std::vector <NETLIST_OBJECT*>& aNetObjectslist );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
/** Function ReturnUserNetlistTypeName
|
|
|
|
* to retrieve user netlist type names
|
|
|
|
* @param first = true: return first name of the list, false = return next
|
|
|
|
* @return a wxString : name of the type netlist or empty string
|
|
|
|
* this function must be called first with "first_item" = true
|
2009-11-04 20:46:53 +00:00
|
|
|
* and after with "first_item" = false to get all the other existing netlist
|
|
|
|
* names
|
2007-11-10 14:35:04 +00:00
|
|
|
*/
|
2009-07-05 12:09:41 +00:00
|
|
|
wxString ReturnUserNetlistTypeName( bool first_item );
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#endif
|