⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 acis_tutorials_(history_streams).htm

📁 acis说明文档
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
				<meta name="keywords" content="Tutorial:ACIS Tutorials (History Streams),Tutorial:ACIS Tutorials,Tutorial:ACIS Tutorials (ACIS Tolerances),Tutorial:ACIS Tutorials (Attributes),Tutorial:ACIS Tutorials (Background),Tutorial:ACIS Tutorials (Creating Applications),Tutorial:ACIS Tutorials (Exception Handling),Tutorial:ACIS Tutorials (Geometry),Tutorial:ACIS Tutorials (Importing Non-ACIS Models),Tutorial:ACIS Tutorials (Math Classes),Tutorial:ACIS Tutorials (Memory Management)" />		<link rel="shortcut icon" href="/favicon.ico" />		<link rel="search" type="application/opensearchdescription+xml" href="/r18/opensearch_desc.php" title="DocR18 (English)" />		<link title="Creative Commons" type="application/rdf+xml" href="/r18/index.php?title=Tutorial:ACIS_Tutorials_%28History_Streams%29&amp;action=creativecommons" rel="meta" />		<title>Tutorial:ACIS Tutorials (History Streams) - DocR18</title>
		<style type="text/css" media="screen, projection">/*<![CDATA[*/
			@import "/r18/skins/common/shared.css?97";
			@import "/r18/skins/monobook/main.css?97";
		/*]]>*/</style>
		<link rel="stylesheet" type="text/css" media="print" href="/r18/skins/common/commonPrint.css?97" />
		<!--[if lt IE 5.5000]><style type="text/css">@import "/r18/skins/monobook/IE50Fixes.css?97";</style><![endif]-->
		<!--[if IE 5.5000]><style type="text/css">@import "/r18/skins/monobook/IE55Fixes.css?97";</style><![endif]-->
		<!--[if IE 6]><style type="text/css">@import "/r18/skins/monobook/IE60Fixes.css?97";</style><![endif]-->
		<!--[if IE 7]><style type="text/css">@import "/r18/skins/monobook/IE70Fixes.css?97";</style><![endif]-->
		<!--[if lt IE 7]><script type="text/javascript" src="/r18/skins/common/IEFixes.js?97"></script>
		<meta http-equiv="imagetoolbar" content="no" /><![endif]-->
		
		<script type= "text/javascript">/*<![CDATA[*/var skin = "monobook";var stylepath = "/r18/skins";var wgArticlePath = "/r18/index.php/$1";var wgScriptPath = "/r18";var wgScript = "/r18/index.php";var wgServer = "http://doc.spatial.com";var wgCanonicalNamespace = "";var wgCanonicalSpecialPageName = false;var wgNamespaceNumber = 0;var wgPageName = "Tutorial:ACIS_Tutorials_(History_Streams)";var wgTitle = "Tutorial:ACIS Tutorials (History Streams)";var wgAction = "view";var wgRestrictionEdit = ["sysop"];var wgRestrictionMove = ["sysop"];var wgArticleId = "425";var wgIsArticle = true;var wgUserName = null;var wgUserGroups = null;var wgUserLanguage = "en";var wgContentLanguage = "en";var wgBreakFrames = false;var wgCurRevisionId = "1143";/*]]>*/</script>                
		<script type="text/javascript" src="/r18/skins/common/wikibits.js?97"><!-- wikibits js --></script>
		<script type="text/javascript" src="/r18/index.php?title=-&amp;action=raw&amp;gen=js&amp;useskin=monobook"><!-- site js --></script>
		<style type="text/css">/*<![CDATA[*/@import "/r18/index.php?title=MediaWiki:Common.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000";@import "/r18/index.php?title=MediaWiki:Monobook.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=18000";@import "/r18/index.php?title=-&action=raw&gen=css&maxage=18000";/*]]>*/</style>
		<!-- Head Scripts -->
		<script type="text/javascript" src="/r18/skins/common/ajax.js?97"></script>	</head>
<body  class="mediawiki ns-0 ltr page-Tutorial_ACIS_Tutorials_History_Streams">
	<div id="globalWrapper">
		<div id="column-content">
	<div id="content">
		<a name="top" id="top"></a>
				<h1 class="firstHeading">Tutorial:ACIS Tutorials (History Streams)</h1>
		<div id="bodyContent">
			<h3 id="siteSub">From DocR18</h3>
			<div id="contentSub"></div>
									<div id="jump-to-nav">Jump to: <a href="#column-one">navigation</a>, <a href="#searchInput">search</a></div>			<!-- start content -->
			<table style="background:transparent; font-size:90%; text-align:center; width:100%" cellspacing="0" cellpadding="0" border="0"><tr><td style="padding:0.5em; background-color:#e3e5e7; font-size:90%; line-height:0.95em; border:1px solid #A3B1BF; border-bottom:solid 2px #A3B1BF" width="20"> <a href="/r18/index.php/Tutorial:ACIS_Tutorials" title="Tutorial:ACIS Tutorials">Start</a></td><td style="border-bottom:2px solid #A3B1BF" width="3">&nbsp;</td><td style="padding:0.5em; background-color:#e3e5e7; font-size:90%; line-height:0.95em; border:1px solid #A3B1BF; border-bottom:solid 2px #A3B1BF" width="20"> <a href="/r18/index.php/Tutorial:ACIS_Tutorials_%28Background%29" title="Tutorial:ACIS Tutorials (Background)">Fundamentals</a></td><td style="border-bottom:2px solid #A3B1BF" width="3">&nbsp;</td><td style="padding:0.5em; background-color:#e3e5e7; font-size:90%; line-height:0.95em; border:1px solid #A3B1BF; border-bottom:solid 2px #A3B1BF" width="20"> <a href="/r18/index.php/Tutorial:ACIS_Tutorials_%28Creating_Applications%29" title="Tutorial:ACIS Tutorials (Creating Applications)">Creating&nbsp;Applications</a></td><td style="border-bottom:2px solid #A3B1BF" width="3">&nbsp;</td><td style="padding:0.5em; background-color:#e3e5e7; font-size:90%; line-height:0.95em; border:1px solid #A3B1BF; border-bottom:solid 2px #A3B1BF" width="20"> <a href="/r18/index.php/Tutorial:ACIS_Tutorials_%28Model_Topology%29" title="Tutorial:ACIS Tutorials (Model Topology)">Topology</a></td><td style="border-bottom:2px solid #A3B1BF" width="3">&nbsp;</td><td style="padding:0.5em; background-color:#e3e5e7; font-size:90%; line-height:0.95em; border:1px solid #A3B1BF; border-bottom:solid 2px #A3B1BF" width="20"> <a href="/r18/index.php/Tutorial:ACIS_Tutorials_%28Geometry%29" title="Tutorial:ACIS Tutorials (Geometry)">Geometry</a></td><td style="border-bottom:2px solid #A3B1BF" width="3">&nbsp;</td><td style="padding:0.5em; background-color:#e3e5e7; font-size:90%; line-height:0.95em; border:1px solid #A3B1BF; border-bottom:solid 2px #A3B1BF" width="20"> <a href="/r18/index.php/Tutorial:ACIS_Tutorials_%28Math_Classes%29" title="Tutorial:ACIS Tutorials (Math Classes)">Math&nbsp;Classes</a></td><td style="border-bottom:2px solid #A3B1BF" width="3">&nbsp;</td><td style="padding:0.5em; background-color:#e3e5e7; font-size:90%; line-height:0.95em; border:1px solid #A3B1BF; border-bottom:solid 2px #A3B1BF" width="20"> <a href="/r18/index.php/Tutorial:ACIS_Tutorials_%28ACIS_Tolerances%29" title="Tutorial:ACIS Tutorials (ACIS Tolerances)">Tolerances</a></td><td style="border-bottom:2px solid #A3B1BF" width="3">&nbsp;</td><td style="padding:0.5em; background-color:#e3e5e7; font-size:90%; line-height:0.95em; border:1px solid #A3B1BF; border-bottom:solid 2px #A3B1BF" width="20"> <a href="/r18/index.php/Tutorial:ACIS_Tutorials_%28Options%29" title="Tutorial:ACIS Tutorials (Options)">Options</a></td><td style="border-bottom:2px solid #A3B1BF" width="3">&nbsp;</td><td style="padding:0.5em; background-color:#e3e5e7; font-size:90%; line-height:0.95em; border:1px solid #A3B1BF; border-bottom:solid 2px #A3B1BF" width="20"> <a href="/r18/index.php/Tutorial:ACIS_Tutorials_%28Memory_Management%29" title="Tutorial:ACIS Tutorials (Memory Management)">Memory&nbsp;Management</a></td><td style="border-bottom:2px solid #A3B1BF" width="3">&nbsp;</td><td style="padding:0.5em; background-color:#e3e5e7; font-size:90%; line-height:0.95em; border:1px solid #A3B1BF; border-bottom:solid 2px #A3B1BF" width="20"> <a href="/r18/index.php/Tutorial:ACIS_Tutorials_%28Exception_Handling%29" title="Tutorial:ACIS Tutorials (Exception Handling)">Exception&nbsp;Handling</a></td><td style="border-bottom:2px solid #A3B1BF" width="3">&nbsp;</td><td style="padding:0.5em; background-color:white; line-height:0.95em; border:solid 2px #A3B1BF; border-bottom:0; font-weight:bold;" width="20"> <strong class="selflink">History</strong></td><td style="border-bottom:2px solid #A3B1BF" width="3"> &nbsp;</td><td style="padding:0.5em; background-color:#e3e5e7; font-size:90%; line-height:0.95em; border:1px solid #A3B1BF; border-bottom:solid 2px #A3B1BF" width="20"> <a href="/r18/index.php/Tutorial:ACIS_Tutorials_%28Attributes%29" title="Tutorial:ACIS Tutorials (Attributes)">Attributes</a></td><td style="border-bottom:2px solid #A3B1BF" width="3">&nbsp;</td><td style="padding:0.5em; background-color:#e3e5e7; font-size:90%; line-height:0.95em; border:1px solid #A3B1BF; border-bottom:solid 2px #A3B1BF" width="20"> <a href="/r18/index.php/Tutorial:ACIS_Tutorials_%28Importing_Non-ACIS_Models%29" title="Tutorial:ACIS Tutorials (Importing Non-ACIS Models)">Importing&nbsp;Models</a></td><td style="border-bottom:2px solid #A3B1BF" width="3">&nbsp;</td><td style="border-bottom:2px solid #A3B1BF" width="3000"> &nbsp;</td></tr></table><div style="border:2px solid #A3B1BF; padding:.5em 1em 1em 1em; border-top:none; background-color:#fff; color:#000"><a name="History_and_Roll"></a><h2> <span class="mw-headline"> History and Roll </span></h2><div style="float:right;"><a href="http://doc.spatial.com/r18/index.php?title=Tutorial:ACIS_Tutorial_10:_Dabbling_in_ACIS_History_Streams&amp;action=edit" class="external text" title="http://doc.spatial.com/r18/index.php?title=Tutorial:ACIS_Tutorial_10:_Dabbling_in_ACIS_History_Streams&amp;action=edit" rel="nofollow"><span style="color: #000000">edit</span></a></div><table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div><ul><li class="toclevel-1"><a href="#History_and_Roll"><span class="tocnumber">1</span> <span class="toctext">History and Roll</span></a></li><li class="toclevel-1"><a href="#An_Overview_of_the_History_Mechanism"><span class="tocnumber">2</span> <span class="toctext">An Overview of the History Mechanism</span></a></li><li class="toclevel-1"><a href="#The_Data_Structure"><span class="tocnumber">3</span> <span class="toctext">The Data Structure</span></a><ul><li class="toclevel-2"><a href="#Bulletins"><span class="tocnumber">3.1</span> <span class="toctext">Bulletins</span></a></li><li class="toclevel-2"><a href="#Bulletin_Boards"><span class="tocnumber">3.2</span> <span class="toctext">Bulletin Boards</span></a></li><li class="toclevel-2"><a href="#Delta_States"><span class="tocnumber">3.3</span> <span class="toctext">Delta States</span></a></li><li class="toclevel-2"><a href="#History_Streams"><span class="tocnumber">3.4</span> <span class="toctext">History Streams</span></a></li></ul></li><li class="toclevel-1"><a href="#Using_the_History_Mechanism"><span class="tocnumber">4</span> <span class="toctext">Using the History Mechanism</span></a></li><li class="toclevel-1"><a href="#Two_C.2B.2B_Examples"><span class="tocnumber">5</span> <span class="toctext">Two C++ Examples</span></a></li></ul></td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script><p>This tutorial provides an introduction to the ACIS history mechanism.  ACIS provides some rather complex mechanisms for managing the history of a model; however, in this tutorial we shall concentrate on the basic concepts.  In particular we shall focus on a single history stream and we shall not use the part manager.  If after reading this tutorial you desire to learn more about these more advanced topics, please refer to <a href="/r18/index.php?title=History_and_Roll&amp;action=edit" class="new" title="History and Roll">History and Roll</a> and <a href="/r18/index.php?title=Part_Management&amp;action=edit" class="new" title="Part Management">Part Management</a>.</p><a name="An_Overview_of_the_History_Mechanism"></a><h2> <span class="mw-headline"> An Overview of the History Mechanism </span></h2><p>As we have mentioned in previous tutorials all operations that change the ACIS model must be within an API_BEGIN / API_END block.  (By this we mean all model changes must be within a block of code surrounded by a pair of macros in the API_BEGIN / API_END family.)  As we mentioned before these blocks can be nested.  The outermost API_BEGIN statement denotes the beginning of a bulletin board and the outmost API_END statement denotes the end of the bulletin board.  Every creation, modification, or deletion of an ENTITY during the operation will be recorded on a bulletin.  Thus a bulletin board contains a list of bulletins, each containing a record of the creation, modification, or deletion of one ENTITY.  Because one operation may consist of multiple API_BEGIN / API_END blocks (perhaps as the result of multiple calls to ACIS API functions), bulletin boards can be grouped together into a delta state.  A delta state is simply a list of bulletin boards.  A modeling session may consist of many operations, so there is a need for a higher level concept that contains many delta states.  This is the role of the history stream.  A history stream contains an n-ary tree structure of delta states.  If the modeling session contains no rolled back operations, the tree structure will be linear, essentially a linked list.  If the modeling session had some rolled back operations and these operations were not pruned from the tree structure, the tree structure will contain branches.  In other words, every state of the ACIS model during a modeling session can be maintained in the history stream.  Of course a modeling session could be quite complicated, requiring thousands or millions of ENTITY changes, which could result in a very large history stream, which would require a very large amount of memory, so ACIS provides mechanisms to reduce the number of delta states retained in the model.</p><a name="The_Data_Structure"></a><h2> <span class="mw-headline"> The Data Structure </span></h2><a name="Bulletins"></a><h3> <span class="mw-headline"> Bulletins </span></h3><p>The lowest level object used in the history mechanism is the BULLETIN.  (Although BULLETIN is in upper case, it is <i>not</i> derived from ENTITY.  The same holds true for BULLETIN_BOARDS, DELTA_STATES, and HISTORY_STREAMS.) A BULLETIN contains a record of an ENTITY being created, changed, or deleted.  The BULLETIN contains a pointer to a copy of the ENTITY before the operation and a copy of the ENTITY after the operation.  If the pointer to the "old" ENTITY (i.e., the copy of the ENTITY before the operation) is NULL, then the BULLETIN is recording the creation of the ENTITY.  The ENTITY did not exist before the operation.  If the pointer to the "new" ENTITY (i.e., the copy of the ENTITY after the operation) is NULL, then the BULLETIN is recording the deletion of the ENTITY.  The ENTITY did not exist after the operation.  If both pointers are non-NULL, implying the ENTITY existed before and after the operation, then the BULLETIN is recording the change of the ENTITY. </p><p>A BULLETIN also contains pointers to the "next" and "previous" BULLETINS in a doubly linked list, and a pointer to the BULLETIN_BOARD that contains the doubly linked list of BULLETINS; i.e., the "owner" of the BULLETIN.</p><a name="Bulletin_Boards"></a><h3> <span class="mw-headline"> Bulletin Boards </span></h3><p>The next lowest level object used in the history mechanism is the BULLETIN_BOARD. A BULLETIN_BOARD contains a doubly linked list of BULLETINS.  The BULLETIN_BOARD actually contains a pointer to the first and last BULLETINS in the BULLETIN_BOARD.  </p><p>A BULLETIN_BOARD is the lowest level construct that can be independently rolled.  If an exception occurs inside of an API_BEGIN / API_END block or an API_TRIAL_BEGIN / API_TRIAL_END block, the BULLETIN_BOARD associated with that operation will be rolled back.  The BULLETIN_BOARD associated with an API_NOP_BEGIN / API_NOP_END block will always be rolled back. </p><p>BULLETIN_BOARDS are maintained in a singly linked list; therefore, each BULLETIN_BOARD contains a "next" pointer.  In addition, each BULLETIN_BOARD contains a pointer to the DELTA_STATE that contains the singly linked list of BULLETIN_BOARDS; i.e., the "owner" of the BULLETIN_BOARD.</p><a name="Delta_States"></a><h3> <span class="mw-headline"> Delta States </span></h3><p>Whereas a BULLETIN_BOARD is the lowest level construct that can be independently rolled, a DELTA_STATE is the construct with which the end user would interact to roll the model backward and forward; i.e., perform "undo" and "redo" operations on the model.  A DELTA_STATE contains one or more BULLETIN_BOARDS and typically represents an entire operation from the end user's perspective.  As its name implies a DELTA_STATE records the difference between two states, not a state.  </p><p>A DELTA_STATE contains a pointer to the first BULLETIN_BOARD in a singly linked list of BULLETIN_BOARDS.  DELTA_STATES are maintained in a trees struture.  Each DELTA_STATE contains "next", "previous", and "partner" pointers.  The "partner" pointer is a "sibling" pointer.  "partner" pointers allows branches in the history.  If there were no "partner" pointers, the history would be a doubly linked list of DELTA_STATES. In addition, each DELTA_STATE contains a pointer to the HISTORY_STREAM that contains the tree of DELTA_STATES; i.e., the "owner" of the DELTA_STATE.</p><p>BULLETIN_BOARDS are associated with API_BEGIN / API_END blocks.  DELTA_STATES are associated with calls to api_note_state( ).  Whenever api_note_state( ) is called all the BULLETIN_BOARDS since the previous call to api_note_state( ) are stored in a DELTA_STATE.  In other words, a DELTA_STATE represents the model changes between calls to api_note_state( ).  </p><p>Some more terminology:  During a modeling session there is an "open" DELTA_STATE.  This is the "current" DELTA_STATE.  As BULLETIN_BOARDS are created they are added to the "current" DELTA_STATE.  When api_note_state( ) is called the "current" DELTA_STATE is "closed" and another DELTA_STATE is "opened."  The newly opened DELTA_STATE becomes the "current" DELTA_STATE and the most recently closed DELTA_STATE becomes the "active" DELTA_STATE.  In addition to the "current" and "active" DELTA_STATES, the initial DELTA_STATE in the model is called the "root" DELTA_STATE.</p><p>To permit the end user to move between various states, the application must remember the various DELTA_STATES.  Often numbers or names are associated with the various DELTA_STATES. </p><a name="History_Streams"></a><h3> <span class="mw-headline"> History Streams </span></h3>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -