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

📄 ric_memoryallocationpkg_1.sbs

📁 基于Rhapsody平台的单片机8051的例子
💻 SBS
📖 第 1 页 / 共 4 页
字号:
							}
							{ IAssociationEnd 
								- _id = GUID 4f0fb87b-03ec-47c8-bd8b-dd793355b25b;
								- _name = "itsMediumPool";
								- _multiplicity = "1";
								- _otherClass = { IClassHandle 
									- _m2Class = "IClass";
									- _id = GUID 3b4c187c-b15e-46fe-a35d-b75d6e0bd596;
								}
								- _inverse = { IHandle 
									- _m2Class = "";
								}
								- _linkName = "";
								- _linkType = Assoc;
								- _navigability = Navigable;
							}
							{ IAssociationEnd 
								- _id = GUID ce02ef32-1a75-4201-8369-8c2da10828be;
								- _name = "itsLargePool";
								- _multiplicity = "1";
								- _otherClass = { IClassHandle 
									- _m2Class = "IClass";
									- _id = GUID 3b4c187c-b15e-46fe-a35d-b75d6e0bd596;
								}
								- _inverse = { IHandle 
									- _m2Class = "";
								}
								- _linkName = "";
								- _linkType = Assoc;
								- _navigability = Navigable;
							}
						}
						- PrimitiveOperations = { IRPYRawContainer 
							- size = 3;
							- value = 
							{ IPrimitiveOperation 
								- _id = GUID c2d4e489-c34e-49fc-ae8e-bc4881294c0c;
								- _name = "getMemory";
								- _description = { IDescription 
									- _text = "If the memory desired can be obtained from one of the fixed buffers, then return memory from the appropriate pool, else simply allocate the necessary memory.";
								}
								- _virtual = 0;
								- Args = { IRPYRawContainer 
									- size = 1;
									- value = 
									{ IArgument 
										- _id = GUID 545bd8aa-f2fd-4214-a98e-4b32b64fd7f5;
										- _name = "requestedSize";
										- _defaultValue = "";
										- myTypeOf = { IType 
											- _id = GUID fe39810a-a5f8-41ed-839d-f9b69b4e5d77;
											- AssociationElements = { IRPYRawContainer 
												- size = 0;
											}
											- _declaration = "unsigned int";
											- _kind = Language;
										}
										- _isOrdered = 0;
										- _argumentDirection = In;
									}
								}
								- myReturnType = { IType 
									- _id = GUID 496cfc01-0cdc-466b-aa47-6a8a3109fef7;
									- AssociationElements = { IRPYRawContainer 
										- size = 0;
									}
									- _declaration = "void*";
									- _kind = Language;
								}
								- _abstract = 0;
								- _final = 0;
								- _concurrency = Sequential;
								- _protection = iPublic;
								- _static = 0;
								- _constant = 0;
								- _itsBody = { IBody 
									- _bodyData = "if ( requestedSize <= RIC_SMALL_BUFFER_SIZE )
  return ( RiCMemoryPool_getMemory(RiCAllocator.itsSmallPool) );
  
//if ( requestedSize <= RIC_MEDIUM_BUFFER_SIZE )
//  return ( RiCMemoryPool_getMemory(RiCAllocator.itsMediumPool) );

//if ( requestedSize <= RIC_LARGE_BUFFER_SIZE )
//  return ( RiCMemoryPool_getMemory(RiCAllocator.itsLargePool) );

//assert( FALSE );  
return ( NULL );";
								}
							}
							{ IPrimitiveOperation 
								- _id = GUID b7d725a2-2216-4551-b8fd-088ba3575192;
								- _name = "returnMemory";
								- _description = { IDescription 
									- _text = "return the memory.";
								}
								- _virtual = 0;
								- Args = { IRPYRawContainer 
									- size = 2;
									- value = 
									{ IArgument 
										- _id = GUID 6c27a738-b173-4fa4-9150-36d3481853e2;
										- _name = "memory";
										- _defaultValue = "";
										- myTypeOf = { IType 
											- _id = GUID 928896d0-4cb7-4021-b39b-ce338f41f59c;
											- AssociationElements = { IRPYRawContainer 
												- size = 0;
											}
											- _declaration = "void*";
											- _kind = Language;
										}
										- _isOrdered = 0;
										- _argumentDirection = In;
									}
									{ IArgument 
										- _id = GUID f1971ab3-7dc7-4e2d-a9cc-39f4f821ad11;
										- _name = "requestedSize";
										- _defaultValue = "";
										- myTypeOf = { IType 
											- _id = GUID d62966d3-7409-45e5-bab8-162781c9757b;
											- AssociationElements = { IRPYRawContainer 
												- size = 0;
											}
											- _declaration = "unsigned int";
											- _kind = Language;
										}
										- _isOrdered = 0;
										- _argumentDirection = In;
									}
								}
								- _returnType = { IHandle 
									- _m2Class = "IType";
									- _filename = "PredefinedTypes.sbs";
									- _subsystem = "PredefinedTypes";
									- _class = "";
									- _name = "void";
									- _id = GUID 1ae3fac8-89cb-11d2-b813-00104b3e6572;
								}
								- _abstract = 0;
								- _final = 0;
								- _concurrency = Sequential;
								- _protection = iPublic;
								- _static = 0;
								- _constant = 0;
								- _itsBody = { IBody 
									- _bodyData = "if ( requestedSize <= RIC_SMALL_BUFFER_SIZE )
  RiCMemoryPool_returnMemory(RiCAllocator.itsSmallPool, memory);
  
else if ( requestedSize <= RIC_MEDIUM_BUFFER_SIZE )
  RiCMemoryPool_returnMemory(RiCAllocator.itsMediumPool, memory);
  
else if ( requestedSize <= RIC_LARGE_BUFFER_SIZE )
  RiCMemoryPool_returnMemory(RiCAllocator.itsLargePool, memory);
  
else
  assert( FALSE );";
								}
							}
							{ IPrimitiveOperation 
								- _id = GUID 437f4ef1-61bc-426a-8788-d21620d16d4e;
								- _name = "usage";
								- _description = { IDescription 
									- _text = "During debug, it is interesting to get an idea of how many buffers have been allocated. This operation will print for each pool, the maximum usage and the number of allocations.";
								}
								- _virtual = 0;
								- Args = { IRPYRawContainer 
									- size = 0;
								}
								- _returnType = { IHandle 
									- _m2Class = "IType";
									- _filename = "PredefinedTypes.sbs";
									- _subsystem = "PredefinedTypes";
									- _class = "";
									- _name = "void";
									- _id = GUID 1ae3fac8-89cb-11d2-b813-00104b3e6572;
								}
								- _abstract = 0;
								- _final = 0;
								- _concurrency = Sequential;
								- _protection = iPublic;
								- _static = 0;
								- _constant = 0;
								- _itsBody = { IBody 
									- _bodyData = "RiCMemoryPool_usage ( RiCAllocator.itsSmallPool );
RiCMemoryPool_usage ( RiCAllocator.itsMediumPool );
RiCMemoryPool_usage ( RiCAllocator.itsLargePool );";
								}
							}
						}
						- TriggeredOperations = { IRPYRawContainer 
							- size = 0;
						}
						- Receptions = { IRPYRawContainer 
							- size = 0;
						}
						- ObjectLinks = { IRPYRawContainer 
							- size = 0;
						}
						- _classModifier = Unspecified;
					}
				}
			}
			- PrimitiveOperations = { IRPYRawContainer 
				- size = 0;
			}
			- TriggeredOperations = { IRPYRawContainer 
				- size = 0;
			}
			- Receptions = { IRPYRawContainer 
				- size = 0;
			}
			- ObjectLinks = { IRPYRawContainer 
				- size = 3;
				- value = 
				{ IObjectLink 
					- _id = GUID be38ab3e-4efb-4cb6-82b2-81a0d5d40c7a;
					- _myState = 2048;
					- _name = "RiCAllocator_RiCSmallPool";
					- _toLink = { IHandle 
						- _m2Class = "IPart";
						- _id = GUID 089e6b8b-b6dc-46d0-b25c-bc06ba8e90e8;
					}
					- _fromLink = { IHandle 
						- _m2Class = "IPart";
						- _id = GUID c8b5bbbc-5d3d-4fe4-96ee-2098c2d74195;
					}
					- _instantiates = { IMetaLinkHandle 
						- _m2Class = "IAssociationEnd";
						- _id = GUID 9b3e7c2d-43a0-46e5-b156-4e19fed80414;
					}
					- _toPort = { IHandle 
						- _m2Class = "";
					}
					- _fromPort = { IHandle 
						- _m2Class = "";
					}
				}
				{ IObjectLink 
					- _id = GUID 49592c9c-0650-4a25-8cc6-70633cbad230;
					- _myState = 2048;
					- _name = "RiCAllocator_RiCMediumPool";
					- _toLink = { IHandle 
						- _m2Class = "IPart";
						- _id = GUID 160ee633-8f4e-4e58-8195-e2be3652137a;
					}
					- _fromLink = { IHandle 
						- _m2Class = "IPart";
						- _id = GUID c8b5bbbc-5d3d-4fe4-96ee-2098c2d74195;
					}
					- _instantiates = { IMetaLinkHandle 
						- _m2Class = "IAssociationEnd";
						- _id = GUID 4f0fb87b-03ec-47c8-bd8b-dd793355b25b;
					}
					- _toPort = { IHandle 
						- _m2Class = "";
					}
					- _fromPort = { IHandle 
						- _m2Class = "";
					}
				}
				{ IObjectLink 
					- _id = GUID a2522e81-66a3-45a9-aee4-eaa32dc324b5;
					- _myState = 2048;
					- _name = "RiCAllocator_RiCLargePool";
					- _toLink = { IHandle 
						- _m2Class = "IPart";
						- _id = GUID 439e04a5-a330-4992-84f4-b0ae0f24118f;
					}
					- _fromLink = { IHandle 
						- _m2Class = "IPart";
						- _id = GUID c8b5bbbc-5d3d-4fe4-96ee-2098c2d74195;
					}
					- _instantiates = { IMetaLinkHandle 
						- _m2Class = "IAssociationEnd";
						- _id = GUID ce02ef32-1a75-4201-8369-8c2da10828be;
					}
					- _toPort = { IHandle 
						- _m2Class = "";
					}
					- _fromPort = { IHandle 
						- _m2Class = "";
					}
				}
			}
			- _classModifier = Unspecified;
		}
		{ IClass 
			- _id = GUID 3b4c187c-b15e-46fe-a35d-b75d6e0bd596;
			- _myState = 8192;
			- _properties = { IPropertyContainer 
				- Subjects = { IRPYRawContainer 
					- size = 1;
					- value = 
					{ IPropertySubject 
						- _Name = "CG";
						- Metaclasses = { IRPYRawContainer 
							- size = 1;
							- value = 
							{ IPropertyMetaclass 
								- _Name = "Package";
								- Properties = { IRPYRawContainer 
									- size = 1;
									- value = 
									{ IProperty 
										- _Name = "GenerateWithAggregates";
										- _Value = "False";
										- _Type = Bool;
									}
								}
							}
						}
					}
				}
			}
			- _name = "RiCMemoryPool";
			- Dependencies = { IRPYRawContainer 
				- size = 1;
				- value = 
				{ IDependency 
					- _id = GUID cbdb3a2e-8260-4b3e-a42b-794f04cb27d4;
					- _name = "RiCErrorManager";
					- Stereotypes = { IRPYRawContainer 
						- size = 1;
						- value = 
						{ IHandle 
							- _m2Class = "IStereotype";
							- _filename = "PredefinedTypes.sbs";
							- _subsystem = "PredefinedTypes";
							- _class = "";
							- _name = "Usage";
							- _id = GUID 42aa4325-6112-4e88-87ce-66008878f1db;
						}
					}
					- _dependsOn = { INObjectHandle 
						- _m2Class = "IClass";
						- _filename = "RiC_RPkg.sbs";
						- _subsystem = "RiC_IdfP::RiC_RPkg";
						- _class = "TopLevel";
						- _name = "RiCErrorManager";
						- _id = GUID 4c6070c9-3a1b-4e9a-99ba-ef82eedeb5d1;
					}
				}
			}
			- _theMainDiagram = { IHandle 
				- _m2Class = "IDiagram";
				- _id = GUID 573c4d58-71cd-404e-b866-4f22323a6509;
			}
			- _description = { IDescription 
				- _text = "This class initially creates a fixed number of memory blocks 
all of which are linked together onto the free list.
As memory is requested, a block is taken from the free list
and when it is returned it is added back to the free list.
If the free list is empty, then another memory block is
dynamically allocated. The operation usage can be called
to see how many times each pool has been used and also
get the maximum number of memory blocks that the pool
contains. ";
			}
			- _lastID = 14;
			- weakCGTime = 12.15.2003::20:51:4;
			- strongCGTime = 12.15.2003::20:51:4;
			- AssociationElements = { IRPYRawContainer 
				- size = 0;
			}
			- Attrs = { IRPYRawContainer 
				- size = 4;
				- value = 
				{ IAttribute 
					- _id = GUID de7fb3dd-0abf-4c41-825e-70bfd9d5ca0a;
					- _name = "blockSize";
					- _defaultValue = "";
					- _typeOf = { IHandle 
						- _m2Class = "IType";
						- _filename = "PredefinedTypes.sbs";
						- _subsystem = "PredefinedTypes";
						- _class = "";
						- _name = "int";
						- _id = GUID 1ae3fac5-89cb-11d2-b813-00104b3e6572;
					}
					- _isOrdered = 0;
					- _protection = iPublic;
					- _static = 0;
					- _isReference = 0;
					- _isConstant = 0;
				}
				{ IAttribute 
					- _id = GUID b7531a26-3707-430f-bab4-782fe19392c4;
					- _name = "freeList";
					- _defaultValue = "";
					- _typeOf = { IHandle 
						- _m2Class = "IType";
						- _filename = "PredefinedTypes.sbs";
						- _subsystem = "PredefinedTypes";
						- _class = "";
						- _name = "void *";
						- _id = GUID 1ae3facc-89cb-11d2-b813-00104b3e6572;
					}
					- _isOrdered = 0;
					- _protection = iPublic;
					- _static = 0;
					- _isReference = 0;
					- _isConstant = 0;
				}
				{ IAttribute 
					- _id = GUID 5e8ac7c2-5d68-4e78-841a-08c00b6fe873;
					- _name = "use";
					- _defaultValue = "";
					- _typeOf = { IHandle 
						- _m2Class = "IType";
						- _filename = "PredefinedTypes.sbs";
						- _subsystem = "PredefinedTypes";
						- _class = "";
						- _name = "int";
						- _id = GUID 1ae3fac5-89cb-11d2-b813-00104b3e6572;
					}
					- _isOrdered = 0;
					- _protection = iPublic;
					- _static = 0;
					- _isReference = 0;
					- _isConstant = 0;
				}
				{ IAttribute 
					- _id = GUID ff67f433-3c78-47cc-8fb8-b7cfde0448ad;
					- _name = "maxBlocks";
					- _defaultValue = "";
					- _typeOf = { IHandle 
						- _m2Class = "IType";
						- _filename = "PredefinedTypes.sbs";
						- _subsystem = "PredefinedTypes";
						- _class = "";
						- _name = "int";
						- _id = GUID 1ae3fac5-89cb-11d2-b813-00104b3e6572;
					}
					- _isOrdered = 0;
					- _protection = iPublic;
					- _static = 0;
					- _isReference = 0;
					- _isConstant = 0;
				}
			}
			- _multiplicity = "";
			- _itsStateChart = NULL;
			- Associations = { IRPYRawContainer 
				- size = 0;
			}
			- PrimitiveOperations = { IRPYRawContainer 
				- size = 7;
				- value = 
				{ IPrimitiveOperation 
					- _id = GUID 3d8f644b-7af3-41ec-8588-76c8e582f5a6;
					- _name = "returnMemory";
					- _description = { IDescription 
						- _text = "Return the memory to the bottom of the free list.";
					}
					- _virtual = 0;
					- Args = { IRPYRawContainer 
						- size = 1;
						- value = 
						{ IArgument 
							- _id = GUID 0cd542df-6f4c-4eb7-8b2b-d024b1575622;
							- _name = "memory";
							- _defaultValue = "";
							- myTypeOf = { IType 
								- _id = GUID a44b1770-4245-49d8-bd2a-4330206c239a;
								- AssociationElements = { IRPYRawContainer 
									- size = 0;
								}
								- _declaration = "void*";
								- _kind = Language;

⌨️ 快捷键说明

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