📄 swarm.simtools.uname.protocol.html
字号:
<HTML><HEAD><TITLE>UName</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.53"><LINKREL="HOME"TITLE="Documentation Set for Swarm 2.1.1"HREF="set.html"><LINKREL="UP"TITLE="Simtools Library"HREF="swarm.simtools.sgml.reference.html"><LINKREL="PREVIOUS"TITLE="QSort"HREF="swarm.simtools.qsort.protocol.html"><LINKREL="NEXT"TITLE="General"HREF="swarm.simtools.generic.module.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">Documentation Set for Swarm 2.1.1</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="swarm.simtools.qsort.protocol.html">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom">Reference VI. Simtools Library</TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="swarm.simtools.generic.module.html">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><H1><ANAME="SWARM.SIMTOOLS.UNAME.PROTOCOL">UName</A></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN16348"></A><H2>Name</H2>UName -- A class used to generate unique names (e.g. "critter1", "critter2" etc.)</DIV><DIVCLASS="REFSECT1"><ANAME="AEN16351"></A><H2>Description</H2><P> This class is used to generate unique names (agent0, agent1, agent2...) for objects in a simulation. The user will typically create an instance of the UName class initialized with a baseName presented either as a (const char *) or an object of class String. The user can then request new names, again either as (const char *)'s or as instances of the String class. The user can also reset the counter used to generate the names in case s/he wants to restart naming objects with the same baseName.</P><P> Note: Both in the case of initialization by (const char *) and initialization by an instance of the String class, the original is copied not stored internally so it is up to the user to free the original (const char *) or String instance if/when necessary!</P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN16355"></A><H2>Protocols adopted by UName</H2><P> <AHREF="swarm.objectbase.swarmobject.protocol.html">SwarmObject</A> <AHREF="swarm.defobj.creatable.protocol.html">CREATABLE</A></P></DIV><DIVCLASS="REFSECT1"><ANAME="AEN16360"></A><H2>Methods</H2><DIVCLASS="REFSECT2"><ANAME="AEN16362"></A><H3>Phase: Creating</H3><P></P><UL><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.SIMTOOLS.UNAME.METHOD.PC.M7"></A><P></P>+ <BCLASS="FUNCPROTOTYPE">create:</B> (id <Zone>)<VARCLASS="PDPARAM">aZone</VAR> <BCLASS="FUNCPROTOTYPE">setBaseName:</B> (const char *)<VARCLASS="PDPARAM">aString</VAR> <BR> The create:setBaseNameObject: method is used to create an instance of the UName class and set the base name given a const char *. This method will automatically reset the counter.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.SIMTOOLS.UNAME.METHOD.PC.M8"></A><P></P>+ <BCLASS="FUNCPROTOTYPE">create:</B> (id <Zone>)<VARCLASS="PDPARAM">aZone</VAR> <BCLASS="FUNCPROTOTYPE">setBaseNameObject:</B> <VARCLASS="PDPARAM">aStringObject</VAR> <BR> The create:setBaseNameObject: method is used to create an instance of the UName class and set the base name given an object of class String. This method will automatically reset the counter.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.SIMTOOLS.UNAME.METHOD.PC.M681"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setBaseName:</B> (const char *)<VARCLASS="PDPARAM">aString</VAR> <BR> The setBaseName: method is used to set the base name given a const char *.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.SIMTOOLS.UNAME.METHOD.PC.M682"></A><P></P>- <BCLASS="FUNCPROTOTYPE">setBaseNameObject:</B> <VARCLASS="PDPARAM">aStringObject</VAR> <BR> The setBaseNameObject: method is used to set the base name given an object of class String.<P></P></DIV></LI></UL></DIV><DIVCLASS="REFSECT2"><ANAME="AEN16405"></A><H3>Phase: Using</H3><P></P><UL><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.SIMTOOLS.UNAME.METHOD.PU.M433"></A><P></P>- (const char *)<BCLASS="FUNCPROTOTYPE">getNewName</B><BR> The getNewName method generates a new name as a character string.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.SIMTOOLS.UNAME.METHOD.PU.M434"></A><P></P>- <BCLASS="FUNCPROTOTYPE">getNewNameObject</B><BR> The getNewNameObject generates a new name as a String Object.<P></P></DIV></LI><LI><DIVCLASS="FUNCSYNOPSIS"><ANAME="SWARM.SIMTOOLS.UNAME.METHOD.PU.M646"></A><P></P>- <BCLASS="FUNCPROTOTYPE">resetCounter</B><BR> Resets the counter used as a suffix in the unique names generated.<P></P></DIV></LI></UL></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLEWIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="swarm.simtools.qsort.protocol.html">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="set.html">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="swarm.simtools.generic.module.html">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">QSort</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="swarm.simtools.sgml.reference.html">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">General</TD></TR></TABLE></DIV></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -