Documentation ¶
Overview ¶
Default generated models package docs (at least one file is necessary in a models package)
generated code - do not edit
generated code - do not edit
generated code - do not edit
generated code - do not edit
generated code - do not edit
generated code - do not edit
generated code - do not edit
generated code - do not edit
generated code - do not edit
generated code - do not edit
Index ¶
- Constants
- Variables
- func AfterCreateFromFront[Type Gongstruct](stage *StageStruct, instance *Type)
- func AfterDeleteFromFront[Type Gongstruct](stage *StageStruct, staged, front *Type)
- func AfterReadFromFront[Type Gongstruct](stage *StageStruct, instance *Type)
- func AfterUpdateFromFront[Type Gongstruct](stage *StageStruct, old, new *Type)
- func CompareGongstructByName[T PointerToGongstruct](a, b T) int
- func CopyBranch[Type Gongstruct](from *Type) (to *Type)
- func EvictInOtherSlices[OwningType PointerToGongstruct, FieldType PointerToGongstruct](stage *StageStruct, owningInstance OwningType, sliceField []FieldType, ...)
- func GetAssociationName[Type Gongstruct]() *Type
- func GetFieldStringValue[Type Gongstruct](instance Type, fieldName string) (res string)
- func GetFieldStringValueFromPointer[Type PointerToGongstruct](instance Type, fieldName string) (res string)
- func GetFields[Type Gongstruct]() (res []string)
- func GetFieldsFromPointer[Type PointerToGongstruct]() (res []string)
- func GetGongstrucsSorted[T PointerToGongstruct](stage *StageStruct) (sortedSlice []T)
- func GetGongstructInstancesMap[Type Gongstruct](stage *StageStruct) *map[string]*Type
- func GetGongstructInstancesSet[Type Gongstruct](stage *StageStruct) *map[*Type]any
- func GetGongstructInstancesSetFromPointerType[Type PointerToGongstruct](stage *StageStruct) *map[Type]any
- func GetGongstructName[Type Gongstruct]() (res string)
- func GetPointerReverseMap[Start, End Gongstruct](fieldname string, stage *StageStruct) map[*End][]*Start
- func GetPointerToGongstructName[Type PointerToGongstruct]() (res string)
- func GetSliceOfPointersReverseMap[Start, End Gongstruct](fieldname string, stage *StageStruct) map[*End]*Start
- func GongGetMap[Type GongstructMapString](stage *StageStruct) *Type
- func GongGetSet[Type GongstructSet](stage *StageStruct) *Type
- func IntToLetters(number int32) (letters string)
- func IsStaged[Type Gongstruct](stage *StageStruct, instance *Type) (ok bool)
- func Min(x, y time.Duration) time.Duration
- func ParseAstFile(stage *StageStruct, pathToFile string) error
- func ParseAstFileFromAst(stage *StageStruct, inFile *ast.File, fset *token.FileSet) error
- func Serialize[Type Gongstruct](stage *StageStruct, tab Tabulator)
- func SerializeExcelize[Type Gongstruct](stage *StageStruct, f *excelize.File)
- func SerializeStage(stage *StageStruct, filename string)
- func SetCallbackAfterCreateFromFront[Type Gongstruct](stage *StageStruct, callback OnAfterCreateInterface[Type])
- func SetCallbackAfterDeleteFromFront[Type Gongstruct](stage *StageStruct, callback OnAfterDeleteInterface[Type])
- func SetCallbackAfterReadFromFront[Type Gongstruct](stage *StageStruct, callback OnAfterReadInterface[Type])
- func SetCallbackAfterUpdateFromFront[Type Gongstruct](stage *StageStruct, callback OnAfterUpdateInterface[Type])
- func SetOrchestratorOnAfterUpdate[Type Gongstruct](stage *StageStruct)
- func SortGongstructSetByName[T PointerToGongstruct](set map[T]any) (sortedSlice []T)
- func StageBranch[Type Gongstruct](stage *StageStruct, instance *Type)
- func UnmarshallGongstructStaging(stage *StageStruct, cmap *ast.CommentMap, assignStmt *ast.AssignStmt, ...) (instance any, identifier string, gongstructName string, fieldName string)
- func UnstageBranch[Type Gongstruct](stage *StageStruct, instance *Type)
- type Agent
- func (agent *Agent) AppendAgentToEngine(newAgent AgentInterface)
- func (agent *Agent) Events() []EventInterface
- func (agent *Agent) GetNextEvent() (EventInterface, time.Time)
- func (agent *Agent) GetNextEventAndRemoveIt() (event EventInterface, t time.Time)
- func (agent *Agent) GetTechName() string
- func (agent *Agent) QueueEvent(event EventInterface)
- func (agent *Agent) QueueUpdateEvent(engine *Engine, duration time.Duration) *Agent
- func (agent *Agent) RemoveAgentToEngine(newAgent AgentInterface)
- func (agent *Agent) Reset()
- func (agent *Agent) SetEngine(engine *Engine)
- func (agent *Agent) TransfertAndQueueEvent(event EventInterface)
- type AgentInterface
- type AllModelsStructCreateInterface
- type AllModelsStructDeleteInterface
- type BackRepoInterface
- type ControlMode
- func (controlmode ControlMode) CodeValues() (res []string)
- func (controlmode ControlMode) Codes() (res []string)
- func (controlmode *ControlMode) FromCodeString(input string) (err error)
- func (controlmode *ControlMode) FromString(input string) (err error)
- func (controlmode *ControlMode) ToCodeString() (res string)
- func (controlmode ControlMode) ToString() (res string)
- type DummyAgent
- func (dummyagent *DummyAgent) Checkout(stage *StageStruct) *DummyAgent
- func (dummyagent *DummyAgent) Commit(stage *StageStruct) *DummyAgent
- func (dummyagent *DummyAgent) CommitVoid(stage *StageStruct)
- func (from *DummyAgent) CopyBasicFields(to *DummyAgent)
- func (dummyAgent *DummyAgent) FireNextEvent()
- func (dummyagent *DummyAgent) GetName() (res string)
- func (dummyagent *DummyAgent) Stage(stage *StageStruct) *DummyAgent
- func (dummyagent *DummyAgent) Unstage(stage *StageStruct) *DummyAgent
- func (dummyagent *DummyAgent) UnstageVoid(stage *StageStruct)
- type DummyAgent_WOP
- type Engine
- func (engine *Engine) Agents() (agents []AgentInterface)
- func (engine *Engine) AppendAgent(agent AgentInterface)
- func (engine *Engine) Checkout(stage *StageStruct) *Engine
- func (engine *Engine) Commit(stage *StageStruct) *Engine
- func (engine *Engine) CommitVoid(stage *StageStruct)
- func (from *Engine) CopyBasicFields(to *Engine)
- func (engine *Engine) FireNextEvent() (agent AgentInterface, nextTimeEvent time.Time, event EventInterface)
- func (engine *Engine) GetCurrentTime() time.Time
- func (engine *Engine) GetEndTime() time.Time
- func (engine *Engine) GetLastCommitNb() (commitNb uint)
- func (engine *Engine) GetLastCommitNbFromFront() (commitNb uint)
- func (engine *Engine) GetName() (res string)
- func (engine *Engine) GetNextEvent() (agent AgentInterface, nextEventFireTime time.Time, event EventInterface)
- func (engine *Engine) GetStartTime() time.Time
- func (engine *Engine) ListEvents()
- func (engine *Engine) RemoveAgent(agent AgentInterface)
- func (engine *Engine) Run()
- func (engine *Engine) RunTillAnyStateHasChanged()
- func (engine *Engine) SetCurrentTime(time time.Time)
- func (engine *Engine) SetEndTime(time time.Time)
- func (engine *Engine) SetStartTime(time time.Time)
- func (engine *Engine) Stage(stage *StageStruct) *Engine
- func (engine *Engine) Unstage(stage *StageStruct) *Engine
- func (engine *Engine) UnstageVoid(stage *StageStruct)
- type EngineDriverState
- func (enginedriverstate EngineDriverState) CodeValues() (res []int)
- func (enginedriverstate EngineDriverState) Codes() (res []string)
- func (enginedriverstate *EngineDriverState) FromCodeString(input string) (err error)
- func (enginedriverstate *EngineDriverState) FromInt(input int) (err error)
- func (enginedriverstate *EngineDriverState) ToCodeString() (res string)
- func (enginedriverstate EngineDriverState) ToInt() (res int)
- type EngineRunMode
- func (enginerunmode EngineRunMode) CodeValues() (res []int)
- func (enginerunmode EngineRunMode) Codes() (res []string)
- func (enginerunmode *EngineRunMode) FromCodeString(input string) (err error)
- func (enginerunmode *EngineRunMode) FromInt(input int) (err error)
- func (enginerunmode *EngineRunMode) ToCodeString() (res string)
- func (enginerunmode EngineRunMode) ToInt() (res int)
- type EngineState
- func (enginestate EngineState) CodeValues() (res []string)
- func (enginestate EngineState) Codes() (res []string)
- func (enginestate *EngineState) FromCodeString(input string) (err error)
- func (enginestate *EngineState) FromString(input string) (err error)
- func (enginestate *EngineState) ToCodeString() (res string)
- func (enginestate EngineState) ToString() (res string)
- type EngineStopMode
- func (enginestopmode EngineStopMode) CodeValues() (res []int)
- func (enginestopmode EngineStopMode) Codes() (res []string)
- func (enginestopmode *EngineStopMode) FromCodeString(input string) (err error)
- func (enginestopmode *EngineStopMode) FromInt(input int) (err error)
- func (enginestopmode *EngineStopMode) ToCodeString() (res string)
- func (enginestopmode EngineStopMode) ToInt() (res int)
- type Engine_WOP
- type Event
- func (event *Event) Checkout(stage *StageStruct) *Event
- func (event *Event) Commit(stage *StageStruct) *Event
- func (event *Event) CommitVoid(stage *StageStruct)
- func (from *Event) CopyBasicFields(to *Event)
- func (event *Event) GetAgent() *Agent
- func (event *Event) GetDuration() time.Duration
- func (event *Event) GetFireTime() time.Time
- func (event *Event) GetName() (res string)
- func (event *Event) SetAgent(agent *Agent)
- func (event *Event) SetFireTime(t time.Time)
- func (event *Event) Stage(stage *StageStruct) *Event
- func (event *Event) Unstage(stage *StageStruct) *Event
- func (event *Event) UnstageVoid(stage *StageStruct)
- type EventInterface
- type Event_WOP
- type ExcelizeTabulator
- type GONG__ExpressionType
- type GONG__Identifier
- type GongStructInterface
- type GongsimCommand
- func (gongsimcommand *GongsimCommand) Checkout(stage *StageStruct) *GongsimCommand
- func (gongsimcommand *GongsimCommand) Commit(stage *StageStruct) *GongsimCommand
- func (gongsimcommand *GongsimCommand) CommitVoid(stage *StageStruct)
- func (from *GongsimCommand) CopyBasicFields(to *GongsimCommand)
- func (gongsimcommand *GongsimCommand) GetName() (res string)
- func (gongsimCommand *GongsimCommand) SetupGongsimThreads() *GongsimCommand
- func (gongsimcommand *GongsimCommand) Stage(stage *StageStruct) *GongsimCommand
- func (gongsimcommand *GongsimCommand) Unstage(stage *StageStruct) *GongsimCommand
- func (gongsimcommand *GongsimCommand) UnstageVoid(stage *StageStruct)
- type GongsimCommandType
- func (gongsimcommandtype GongsimCommandType) CodeValues() (res []string)
- func (gongsimcommandtype GongsimCommandType) Codes() (res []string)
- func (gongsimcommandtype *GongsimCommandType) FromCodeString(input string) (err error)
- func (gongsimcommandtype *GongsimCommandType) FromString(input string) (err error)
- func (gongsimcommandtype *GongsimCommandType) ToCodeString() (res string)
- func (gongsimcommandtype GongsimCommandType) ToString() (res string)
- type GongsimCommand_WOP
- type GongsimStatus
- func (gongsimstatus *GongsimStatus) Checkout(stage *StageStruct) *GongsimStatus
- func (gongsimstatus *GongsimStatus) Commit(stage *StageStruct) *GongsimStatus
- func (gongsimstatus *GongsimStatus) CommitVoid(stage *StageStruct)
- func (from *GongsimStatus) CopyBasicFields(to *GongsimStatus)
- func (gongsimstatus *GongsimStatus) GetName() (res string)
- func (gongsimstatus *GongsimStatus) Stage(stage *StageStruct) *GongsimStatus
- func (gongsimstatus *GongsimStatus) Unstage(stage *StageStruct) *GongsimStatus
- func (gongsimstatus *GongsimStatus) UnstageVoid(stage *StageStruct)
- type GongsimStatus_WOP
- type Gongstruct
- type GongstructEnumIntField
- type GongstructEnumStringField
- type GongstructMapString
- type GongstructSet
- type GongtructBasicField
- type OnAfterCreateInterface
- type OnAfterDeleteInterface
- type OnAfterReadInterface
- type OnAfterUpdateInterface
- type OnInitCommitInterface
- type PointerToGongstruct
- type PointerToGongstructEnumIntField
- type PointerToGongstructEnumStringField
- type ReverseField
- type Simulation
- func (specificEngine *Simulation) CheckoutAgents(engine *Engine)
- func (specificEngine *Simulation) CommitAgents(engine *Engine)
- func (specificEngine *Simulation) EventFired(engine *Engine)
- func (specificEngine *Simulation) GetLastCommitNb() uint
- func (specificEngine *Simulation) GetLastCommitNbFromFront() uint
- func (specificEngine *Simulation) HasAnyStateChanged(engine *Engine) bool
- func (specificEngine *Simulation) Reset(engine *Engine)
- type SimulationInterface
- type SpeedCommandType
- func (speedcommandtype SpeedCommandType) CodeValues() (res []string)
- func (speedcommandtype SpeedCommandType) Codes() (res []string)
- func (speedcommandtype *SpeedCommandType) FromCodeString(input string) (err error)
- func (speedcommandtype *SpeedCommandType) FromString(input string) (err error)
- func (speedcommandtype *SpeedCommandType) ToCodeString() (res string)
- func (speedcommandtype SpeedCommandType) ToString() (res string)
- type StageStruct
- func (stage *StageStruct) Backup(dirPath string)
- func (stage *StageStruct) BackupXL(dirPath string)
- func (stage *StageStruct) Checkout()
- func (stage *StageStruct) Commit()
- func (stage *StageStruct) CommitWithSuspendedCallbacks()
- func (stage *StageStruct) ComputeReverseMaps()
- func (stage *StageStruct) GetPath() string
- func (stage *StageStruct) GetType() string
- func (stage *StageStruct) IsStagedDummyAgent(dummyagent *DummyAgent) (ok bool)
- func (stage *StageStruct) IsStagedEngine(engine *Engine) (ok bool)
- func (stage *StageStruct) IsStagedEvent(event *Event) (ok bool)
- func (stage *StageStruct) IsStagedGongsimCommand(gongsimcommand *GongsimCommand) (ok bool)
- func (stage *StageStruct) IsStagedGongsimStatus(gongsimstatus *GongsimStatus) (ok bool)
- func (stage *StageStruct) Marshall(file *os.File, modelsPackageName, packageName string)
- func (stage *StageStruct) Nil()
- func (stage *StageStruct) Reset()
- func (stage *StageStruct) Restore(dirPath string)
- func (stage *StageStruct) RestoreXL(dirPath string)
- func (stage *StageStruct) StageBranchDummyAgent(dummyagent *DummyAgent)
- func (stage *StageStruct) StageBranchEngine(engine *Engine)
- func (stage *StageStruct) StageBranchEvent(event *Event)
- func (stage *StageStruct) StageBranchGongsimCommand(gongsimcommand *GongsimCommand)
- func (stage *StageStruct) StageBranchGongsimStatus(gongsimstatus *GongsimStatus)
- func (stage *StageStruct) Unstage()
- func (stage *StageStruct) UnstageBranchDummyAgent(dummyagent *DummyAgent)
- func (stage *StageStruct) UnstageBranchEngine(engine *Engine)
- func (stage *StageStruct) UnstageBranchEvent(event *Event)
- func (stage *StageStruct) UnstageBranchGongsimCommand(gongsimcommand *GongsimCommand)
- func (stage *StageStruct) UnstageBranchGongsimStatus(gongsimstatus *GongsimStatus)
- type Tabulator
- type UpdateState
Constants ¶
const IdentifiersDecls = `
{{Identifier}} := (&models.{{GeneratedStructName}}{Name: ` + "`" + `{{GeneratedFieldNameValue}}` + "`" + `}).Stage(stage)`
const NumberInitStatement = `
{{Identifier}}.{{GeneratedFieldName}} = {{GeneratedFieldNameValue}}`
const PointerFieldInitStatement = `
{{Identifier}}.{{GeneratedFieldName}} = {{GeneratedFieldNameValue}}`
const RFC3339MillisFormat = "2006-01-02T15:04:05.000Z07:00"
const SliceOfPointersFieldInitStatement = `
{{Identifier}}.{{GeneratedFieldName}} = append({{Identifier}}.{{GeneratedFieldName}}, {{GeneratedFieldNameValue}})`
const StringEnumInitStatement = `
{{Identifier}}.{{GeneratedFieldName}} = {{GeneratedFieldNameValue}}`
const StringInitStatement = `
{{Identifier}}.{{GeneratedFieldName}} = ` + "`" + `{{GeneratedFieldNameValue}}` + "`"
const TimeInitStatement = `` /* 129-byte string literal not displayed */
Variables ¶
var CpuProfile bool
var DisplayWatch bool
var Quit chan bool
Functions ¶
func AfterCreateFromFront ¶
func AfterCreateFromFront[Type Gongstruct](stage *StageStruct, instance *Type)
AfterCreateFromFront is called after a create from front
func AfterDeleteFromFront ¶
func AfterDeleteFromFront[Type Gongstruct](stage *StageStruct, staged, front *Type)
AfterDeleteFromFront is called after a delete from front
func AfterReadFromFront ¶
func AfterReadFromFront[Type Gongstruct](stage *StageStruct, instance *Type)
AfterReadFromFront is called after a Read from front
func AfterUpdateFromFront ¶
func AfterUpdateFromFront[Type Gongstruct](stage *StageStruct, old, new *Type)
AfterUpdateFromFront is called after a update from front
func CompareGongstructByName ¶
func CompareGongstructByName[T PointerToGongstruct](a, b T) int
func CopyBranch ¶
func CopyBranch[Type Gongstruct](from *Type) (to *Type)
CopyBranch stages instance and apply CopyBranch on all gongstruct instances that are referenced by pointers or slices of pointers of the instance
the algorithm stops along the course of graph if a vertex is already staged
func EvictInOtherSlices ¶
func EvictInOtherSlices[OwningType PointerToGongstruct, FieldType PointerToGongstruct]( stage *StageStruct, owningInstance OwningType, sliceField []FieldType, fieldName string)
EvictInOtherSlices allows for adherance between the gong association model and go.
Says you have a Astruct struct with a slice field "anarrayofb []*Bstruct"
go allows many Astruct instance to have the anarrayofb field that have the same pointers. go slices are MANY-MANY association.
With gong it is only ZERO-ONE-MANY associations, a Bstruct can be pointed only once by an Astruct instance through a given field. This follows the requirement that gong is suited for full stack programming and therefore the association is encoded as a reverse pointer (not as a joint table). In gong, a named struct is translated in a table and each table is a named struct.
EvictInOtherSlices removes the fields instances from other fields of other instance
Note : algo is in O(N)log(N) of nb of Astruct and Bstruct instances
func GetAssociationName ¶
func GetAssociationName[Type Gongstruct]() *Type
GetAssociationName is a generic function that returns an instance of Type where each association is filled with an instance whose name is the name of the association
This function can be handy for generating navigation function that are refactorable
func GetFieldStringValue ¶
func GetFieldStringValue[Type Gongstruct](instance Type, fieldName string) (res string)
func GetFieldStringValueFromPointer ¶
func GetFieldStringValueFromPointer[Type PointerToGongstruct](instance Type, fieldName string) (res string)
func GetFields ¶
func GetFields[Type Gongstruct]() (res []string)
GetFields return the array of the fields
func GetFieldsFromPointer ¶
func GetFieldsFromPointer[Type PointerToGongstruct]() (res []string)
GetFieldsFromPointer return the array of the fields
func GetGongstrucsSorted ¶
func GetGongstrucsSorted[T PointerToGongstruct](stage *StageStruct) (sortedSlice []T)
func GetGongstructInstancesMap ¶
func GetGongstructInstancesMap[Type Gongstruct](stage *StageStruct) *map[string]*Type
GetGongstructInstancesMap returns the map of staged GongstructType instances it is usefull because it allows refactoring of gong struct identifier
func GetGongstructInstancesSet ¶
func GetGongstructInstancesSet[Type Gongstruct](stage *StageStruct) *map[*Type]any
GetGongstructInstancesSet returns the set staged GongstructType instances it is usefull because it allows refactoring of gongstruct identifier
func GetGongstructInstancesSetFromPointerType ¶
func GetGongstructInstancesSetFromPointerType[Type PointerToGongstruct](stage *StageStruct) *map[Type]any
GetGongstructInstancesSetFromPointerType returns the set staged GongstructType instances it is usefull because it allows refactoring of gongstruct identifier
func GetGongstructName ¶
func GetGongstructName[Type Gongstruct]() (res string)
GetGongstructName returns the name of the Gongstruct this can be usefull if one want program robust to refactoring
func GetPointerReverseMap ¶
func GetPointerReverseMap[Start, End Gongstruct](fieldname string, stage *StageStruct) map[*End][]*Start
GetPointerReverseMap allows backtrack navigation of any Start.Fieldname associations (0..1) that is a pointer from one staged Gongstruct (type Start) instances to another (type End)
The function provides a map with keys as instances of End and values to arrays of *Start the map is construed by iterating over all Start instances and populationg keys with End instances and values with slice of Start instances
func GetPointerToGongstructName ¶
func GetPointerToGongstructName[Type PointerToGongstruct]() (res string)
GetPointerToGongstructName returns the name of the Gongstruct this can be usefull if one want program robust to refactoring
func GetSliceOfPointersReverseMap ¶
func GetSliceOfPointersReverseMap[Start, End Gongstruct](fieldname string, stage *StageStruct) map[*End]*Start
GetSliceOfPointersReverseMap allows backtrack navigation of any Start.Fieldname associations (0..N) between one staged Gongstruct instances and many others
The function provides a map with keys as instances of End and values to *Start instances the map is construed by iterating over all Start instances and populating keys with End instances and values with the Start instances
func GongGetMap ¶
func GongGetMap[Type GongstructMapString](stage *StageStruct) *Type
GongGetMap returns the map of staged GongstructType instances it is usefull because it allows refactoring of gong struct identifier
func GongGetSet ¶
func GongGetSet[Type GongstructSet](stage *StageStruct) *Type
GongGetSet returns the set staged GongstructType instances it is usefull because it allows refactoring of gong struct identifier
func IntToLetters ¶
func IsStaged ¶
func IsStaged[Type Gongstruct](stage *StageStruct, instance *Type) (ok bool)
func ParseAstFile ¶
func ParseAstFile(stage *StageStruct, pathToFile string) error
ParseAstFile Parse pathToFile and stages all instances declared in the file
func ParseAstFileFromAst ¶
ParseAstFile Parse pathToFile and stages all instances declared in the file
func Serialize ¶
func Serialize[Type Gongstruct](stage *StageStruct, tab Tabulator)
func SerializeExcelize ¶
func SerializeExcelize[Type Gongstruct](stage *StageStruct, f *excelize.File)
func SerializeStage ¶
func SerializeStage(stage *StageStruct, filename string)
func SetCallbackAfterCreateFromFront ¶
func SetCallbackAfterCreateFromFront[Type Gongstruct](stage *StageStruct, callback OnAfterCreateInterface[Type])
func SetCallbackAfterDeleteFromFront ¶
func SetCallbackAfterDeleteFromFront[Type Gongstruct](stage *StageStruct, callback OnAfterDeleteInterface[Type])
func SetCallbackAfterReadFromFront ¶
func SetCallbackAfterReadFromFront[Type Gongstruct](stage *StageStruct, callback OnAfterReadInterface[Type])
func SetCallbackAfterUpdateFromFront ¶
func SetCallbackAfterUpdateFromFront[Type Gongstruct](stage *StageStruct, callback OnAfterUpdateInterface[Type])
SetCallbackAfterUpdateFromFront is a function to set up callback that is robust to refactoring
func SetOrchestratorOnAfterUpdate ¶
func SetOrchestratorOnAfterUpdate[Type Gongstruct](stage *StageStruct)
func SortGongstructSetByName ¶
func SortGongstructSetByName[T PointerToGongstruct](set map[T]any) (sortedSlice []T)
func StageBranch ¶
func StageBranch[Type Gongstruct](stage *StageStruct, instance *Type)
StageBranch stages instance and apply StageBranch on all gongstruct instances that are referenced by pointers or slices of pointers of the instance
the algorithm stops along the course of graph if a vertex is already staged
func UnmarshallGongstructStaging ¶
func UnmarshallGongstructStaging(stage *StageStruct, cmap *ast.CommentMap, assignStmt *ast.AssignStmt, astCoordinate_ string) ( instance any, identifier string, gongstructName string, fieldName string)
UnmarshallGoStaging unmarshall a go assign statement
func UnstageBranch ¶
func UnstageBranch[Type Gongstruct](stage *StageStruct, instance *Type)
UnstageBranch stages instance and apply UnstageBranch on all gongstruct instances that are referenced by pointers or slices of pointers of the insance
the algorithm stops along the course of graph if a vertex is already staged
Types ¶
type Agent ¶
type Agent struct { TechName string // usefull to append an agent to the Engine from an agent // swagger:ignore Engine *Engine // contains filtered or unexported fields }
Agent is the empty struct to perform generic agents chores
func (*Agent) AppendAgentToEngine ¶
func (agent *Agent) AppendAgentToEngine(newAgent AgentInterface)
AppendAgentToEngine append an agent to the engine
func (*Agent) Events ¶
func (agent *Agent) Events() []EventInterface
Events append an agent to the engine
func (*Agent) GetNextEvent ¶
func (agent *Agent) GetNextEvent() (EventInterface, time.Time)
GetNextEvent provides the next event from a time point of view by convention 0 means infinity
func (*Agent) GetNextEventAndRemoveIt ¶
func (agent *Agent) GetNextEventAndRemoveIt() (event EventInterface, t time.Time)
GetNextEventAndRemoveIt provides the next event from a time point of view by convention 0 means infinity
func (*Agent) GetTechName ¶
Events append an agent to the engine
func (*Agent) QueueEvent ¶
func (agent *Agent) QueueEvent(event EventInterface)
QueueEvent is the function by which an agent queues an event from another agent (or of himself)
func (*Agent) QueueUpdateEvent ¶
QueueUpdateEvent put an UpdateState event with duration to the agent with fire time equals to EngineSingloton current time
return the agent
func (*Agent) RemoveAgentToEngine ¶
func (agent *Agent) RemoveAgentToEngine(newAgent AgentInterface)
RemoveAgentToEngine append an agent to the engine
func (*Agent) Reset ¶
func (agent *Agent) Reset()
Reset removes all events from the agent and resets internal checks
func (*Agent) TransfertAndQueueEvent ¶
func (agent *Agent) TransfertAndQueueEvent(event EventInterface)
type AgentInterface ¶
type AgentInterface interface { // GetNextEvent provides the event with earliest fire time GetNextEvent() (event EventInterface, time time.Time) // FireNextEvent fire next Event FireNextEvent() // Events fire next Event Events() []EventInterface SetEngine(engine *Engine) // Reset Reset() // get technical name GetTechName() string QueueEvent(event EventInterface) TransfertAndQueueEvent(event EventInterface) }
AgentInterface is the interface that must be followed by part of the simulation swagger:model AgentInterface
func AppendToSingloton ¶
func AppendToSingloton(engine *Engine, agent AgentInterface) AgentInterface
Implements the interface function
type AllModelsStructCreateInterface ¶
type AllModelsStructCreateInterface interface { CreateORMDummyAgent(DummyAgent *DummyAgent) CreateORMEngine(Engine *Engine) CreateORMEvent(Event *Event) CreateORMGongsimCommand(GongsimCommand *GongsimCommand) CreateORMGongsimStatus(GongsimStatus *GongsimStatus) }
swagger:ignore
type AllModelsStructDeleteInterface ¶
type AllModelsStructDeleteInterface interface { DeleteORMDummyAgent(DummyAgent *DummyAgent) DeleteORMEngine(Engine *Engine) DeleteORMEvent(Event *Event) DeleteORMGongsimCommand(GongsimCommand *GongsimCommand) DeleteORMGongsimStatus(GongsimStatus *GongsimStatus) }
type BackRepoInterface ¶
type BackRepoInterface interface { Commit(stage *StageStruct) Checkout(stage *StageStruct) Backup(stage *StageStruct, dirPath string) Restore(stage *StageStruct, dirPath string) BackupXL(stage *StageStruct, dirPath string) RestoreXL(stage *StageStruct, dirPath string) // insertion point for Commit and Checkout signatures CommitDummyAgent(dummyagent *DummyAgent) CheckoutDummyAgent(dummyagent *DummyAgent) CommitEngine(engine *Engine) CheckoutEngine(engine *Engine) CommitEvent(event *Event) CheckoutEvent(event *Event) CommitGongsimCommand(gongsimcommand *GongsimCommand) CheckoutGongsimCommand(gongsimcommand *GongsimCommand) CommitGongsimStatus(gongsimstatus *GongsimStatus) CheckoutGongsimStatus(gongsimstatus *GongsimStatus) GetLastCommitFromBackNb() uint GetLastPushFromFrontNb() uint }
type ControlMode ¶
type ControlMode string
swagger:enum ControlMode
const ( AUTONOMOUS ControlMode = "Autonomous" // iota CLIENT_CONTROL ControlMode = "ClientControl" )
values for ControlMode
func (ControlMode) CodeValues ¶
func (controlmode ControlMode) CodeValues() (res []string)
func (ControlMode) Codes ¶
func (controlmode ControlMode) Codes() (res []string)
func (*ControlMode) FromCodeString ¶
func (controlmode *ControlMode) FromCodeString(input string) (err error)
func (*ControlMode) FromString ¶
func (controlmode *ControlMode) FromString(input string) (err error)
func (*ControlMode) ToCodeString ¶
func (controlmode *ControlMode) ToCodeString() (res string)
func (ControlMode) ToString ¶
func (controlmode ControlMode) ToString() (res string)
insertion point of enum utility functions Utility function for ControlMode if enum values are string, it is stored with the value if enum values are int, they are stored with the code of the value
type DummyAgent ¶
func CopyBranchDummyAgent ¶
func CopyBranchDummyAgent(mapOrigCopy map[any]any, dummyagentFrom *DummyAgent) (dummyagentTo *DummyAgent)
insertion point for stage branch per struct
func (*DummyAgent) Checkout ¶
func (dummyagent *DummyAgent) Checkout(stage *StageStruct) *DummyAgent
Checkout dummyagent to the back repo (if it is already staged)
func (*DummyAgent) Commit ¶
func (dummyagent *DummyAgent) Commit(stage *StageStruct) *DummyAgent
commit dummyagent to the back repo (if it is already staged)
func (*DummyAgent) CommitVoid ¶
func (dummyagent *DummyAgent) CommitVoid(stage *StageStruct)
func (*DummyAgent) CopyBasicFields ¶
func (from *DummyAgent) CopyBasicFields(to *DummyAgent)
func (*DummyAgent) FireNextEvent ¶
func (dummyAgent *DummyAgent) FireNextEvent()
func (*DummyAgent) GetName ¶
func (dummyagent *DummyAgent) GetName() (res string)
for satisfaction of GongStruct interface
func (*DummyAgent) Stage ¶
func (dummyagent *DummyAgent) Stage(stage *StageStruct) *DummyAgent
insertion point for cumulative sub template with model space calls Stage puts dummyagent to the model stage
func (*DummyAgent) Unstage ¶
func (dummyagent *DummyAgent) Unstage(stage *StageStruct) *DummyAgent
Unstage removes dummyagent off the model stage
func (*DummyAgent) UnstageVoid ¶
func (dummyagent *DummyAgent) UnstageVoid(stage *StageStruct)
UnstageVoid removes dummyagent off the model stage
type DummyAgent_WOP ¶
insertion point
type Engine ¶
type Engine struct { // Name of the engine "laundramat" for instance Name string EndTime string CurrentTime string // number of the seconds elapsed since the beginning of the simulation SecondsSinceStart float64 // Fired events Fired int // control mode. ControlMode ControlMode // engine state State EngineState // LastEvent ... LastEvent *EventInterface `gorm:"-"` // LastEvent agent LastEventAgent *AgentInterface `gorm:"-"` // Simulation supportspecific callback // on the engine events Simulation SimulationInterface `gorm:"-"` // Speed compared to realtime Speed float64 // contains filtered or unexported fields }
Engine describes a tiny discrete event simulation engine it is responsible for advancing the time An engine manages a set of agents swagger:model Engine
func CopyBranchEngine ¶
func (*Engine) Agents ¶
func (engine *Engine) Agents() (agents []AgentInterface)
func (*Engine) AppendAgent ¶
func (engine *Engine) AppendAgent(agent AgentInterface)
AppendAgent to the engine
func (*Engine) Checkout ¶
func (engine *Engine) Checkout(stage *StageStruct) *Engine
Checkout engine to the back repo (if it is already staged)
func (*Engine) Commit ¶
func (engine *Engine) Commit(stage *StageStruct) *Engine
commit engine to the back repo (if it is already staged)
func (*Engine) CommitVoid ¶
func (engine *Engine) CommitVoid(stage *StageStruct)
func (*Engine) CopyBasicFields ¶
func (*Engine) FireNextEvent ¶
func (engine *Engine) FireNextEvent() (agent AgentInterface, nextTimeEvent time.Time, event EventInterface)
FireNextEvent fires earliest event advances current time
func (*Engine) GetCurrentTime ¶
func (*Engine) GetEndTime ¶
func (*Engine) GetLastCommitNb ¶
func (*Engine) GetLastCommitNbFromFront ¶
func (*Engine) GetNextEvent ¶
func (engine *Engine) GetNextEvent() (agent AgentInterface, nextEventFireTime time.Time, event EventInterface)
GetNextEvent ...
func (*Engine) GetStartTime ¶
func (*Engine) RemoveAgent ¶
func (engine *Engine) RemoveAgent(agent AgentInterface)
RemoveAgent to the engine
func (*Engine) RunTillAnyStateHasChanged ¶
func (engine *Engine) RunTillAnyStateHasChanged()
RunTillAnyStateHasChanged will advance time till currentTime > EndTime or one state Changed in the implementation
func (*Engine) SetCurrentTime ¶
func (*Engine) SetEndTime ¶
func (*Engine) SetStartTime ¶
func (*Engine) Stage ¶
func (engine *Engine) Stage(stage *StageStruct) *Engine
Stage puts engine to the model stage
func (*Engine) Unstage ¶
func (engine *Engine) Unstage(stage *StageStruct) *Engine
Unstage removes engine off the model stage
func (*Engine) UnstageVoid ¶
func (engine *Engine) UnstageVoid(stage *StageStruct)
UnstageVoid removes engine off the model stage
type EngineDriverState ¶
type EngineDriverState int
the states of the engine drivers
const ( COMMIT_AGENT_STATES EngineDriverState = iota CHECKOUT_AGENT_STATES FIRE_ONE_EVENT SLEEP_100_MS RESET_SIMULATION UNKOWN )
func (EngineDriverState) CodeValues ¶
func (enginedriverstate EngineDriverState) CodeValues() (res []int)
func (EngineDriverState) Codes ¶
func (enginedriverstate EngineDriverState) Codes() (res []string)
func (*EngineDriverState) FromCodeString ¶
func (enginedriverstate *EngineDriverState) FromCodeString(input string) (err error)
func (*EngineDriverState) FromInt ¶
func (enginedriverstate *EngineDriverState) FromInt(input int) (err error)
func (*EngineDriverState) ToCodeString ¶
func (enginedriverstate *EngineDriverState) ToCodeString() (res string)
func (EngineDriverState) ToInt ¶
func (enginedriverstate EngineDriverState) ToInt() (res int)
Utility function for EngineDriverState if enum values are string, it is stored with the value if enum values are int, they are stored with the code of the value
type EngineRunMode ¶
type EngineRunMode int
the simulation can run with a relative speed to realtime or full speed
const ( RELATIVE_SPEED EngineRunMode = iota FULL_SPEED )
func (EngineRunMode) CodeValues ¶
func (enginerunmode EngineRunMode) CodeValues() (res []int)
func (EngineRunMode) Codes ¶
func (enginerunmode EngineRunMode) Codes() (res []string)
func (*EngineRunMode) FromCodeString ¶
func (enginerunmode *EngineRunMode) FromCodeString(input string) (err error)
func (*EngineRunMode) FromInt ¶
func (enginerunmode *EngineRunMode) FromInt(input int) (err error)
func (*EngineRunMode) ToCodeString ¶
func (enginerunmode *EngineRunMode) ToCodeString() (res string)
func (EngineRunMode) ToInt ¶
func (enginerunmode EngineRunMode) ToInt() (res int)
Utility function for EngineRunMode if enum values are string, it is stored with the value if enum values are int, they are stored with the code of the value
type EngineState ¶
type EngineState string
swagger:enum EngineState
const ( RUNNING EngineState = "RUNNING" // iota PAUSED EngineState = "PAUSED" OVER EngineState = "OVER" )
values for EngineState
func (EngineState) CodeValues ¶
func (enginestate EngineState) CodeValues() (res []string)
func (EngineState) Codes ¶
func (enginestate EngineState) Codes() (res []string)
func (*EngineState) FromCodeString ¶
func (enginestate *EngineState) FromCodeString(input string) (err error)
func (*EngineState) FromString ¶
func (enginestate *EngineState) FromString(input string) (err error)
func (*EngineState) ToCodeString ¶
func (enginestate *EngineState) ToCodeString() (res string)
func (EngineState) ToString ¶
func (enginestate EngineState) ToString() (res string)
Utility function for EngineState if enum values are string, it is stored with the value if enum values are int, they are stored with the code of the value
type EngineStopMode ¶
type EngineStopMode int
const ( TEN_MINUTES EngineStopMode = iota STATE_CHANGED )
func (EngineStopMode) CodeValues ¶
func (enginestopmode EngineStopMode) CodeValues() (res []int)
func (EngineStopMode) Codes ¶
func (enginestopmode EngineStopMode) Codes() (res []string)
func (*EngineStopMode) FromCodeString ¶
func (enginestopmode *EngineStopMode) FromCodeString(input string) (err error)
func (*EngineStopMode) FromInt ¶
func (enginestopmode *EngineStopMode) FromInt(input int) (err error)
func (*EngineStopMode) ToCodeString ¶
func (enginestopmode *EngineStopMode) ToCodeString() (res string)
func (EngineStopMode) ToInt ¶
func (enginestopmode EngineStopMode) ToInt() (res int)
Utility function for EngineStopMode if enum values are string, it is stored with the value if enum values are int, they are stored with the code of the value
type Engine_WOP ¶
type Engine_WOP struct { // insertion point Name string EndTime string CurrentTime string SecondsSinceStart float64 Fired int ControlMode ControlMode State EngineState Speed float64 }
type Event ¶
type Event struct { Name string // Duration is the difference between the current time and the fire time of the // event. It is handy to compute directly the fire time Duration time.Duration // contains filtered or unexported fields }
Event is the elementary element of a discrete event simulation swagger:model Event
func CopyBranchEvent ¶
func (*Event) Checkout ¶
func (event *Event) Checkout(stage *StageStruct) *Event
Checkout event to the back repo (if it is already staged)
func (*Event) Commit ¶
func (event *Event) Commit(stage *StageStruct) *Event
commit event to the back repo (if it is already staged)
func (*Event) CommitVoid ¶
func (event *Event) CommitVoid(stage *StageStruct)
func (*Event) CopyBasicFields ¶
func (*Event) SetFireTime ¶
func (*Event) Stage ¶
func (event *Event) Stage(stage *StageStruct) *Event
Stage puts event to the model stage
func (*Event) Unstage ¶
func (event *Event) Unstage(stage *StageStruct) *Event
Unstage removes event off the model stage
func (*Event) UnstageVoid ¶
func (event *Event) UnstageVoid(stage *StageStruct)
UnstageVoid removes event off the model stage
type EventInterface ¶
type EventInterface interface { GetFireTime() time.Time SetFireTime(time.Time) GetDuration() time.Duration GetName() string SetAgent(agent *Agent) GetAgent() *Agent }
EventInterface ... swagger:ignore
type ExcelizeTabulator ¶
type ExcelizeTabulator struct {
// contains filtered or unexported fields
}
func (*ExcelizeTabulator) AddCell ¶
func (tab *ExcelizeTabulator) AddCell(sheetName string, rowId, columnIndex int, value string)
func (*ExcelizeTabulator) AddRow ¶
func (tab *ExcelizeTabulator) AddRow(sheetName string) (rowId int)
func (*ExcelizeTabulator) AddSheet ¶
func (tab *ExcelizeTabulator) AddSheet(sheetName string)
func (*ExcelizeTabulator) SetExcelizeFile ¶
func (tab *ExcelizeTabulator) SetExcelizeFile(f *excelize.File)
type GONG__ExpressionType ¶
type GONG__ExpressionType string
swagger:ignore
const ( GONG__STRUCT_INSTANCE GONG__ExpressionType = "STRUCT_INSTANCE" GONG__FIELD_OR_CONST_VALUE GONG__ExpressionType = "FIELD_OR_CONST_VALUE" GONG__FIELD_VALUE GONG__ExpressionType = "FIELD_VALUE" GONG__ENUM_CAST_INT GONG__ExpressionType = "ENUM_CAST_INT" GONG__ENUM_CAST_STRING GONG__ExpressionType = "ENUM_CAST_STRING" GONG__IDENTIFIER_CONST GONG__ExpressionType = "IDENTIFIER_CONST" )
type GONG__Identifier ¶
type GONG__Identifier struct { Ident string Type GONG__ExpressionType }
type GongStructInterface ¶
type GongStructInterface interface {
GetName() (res string)
}
GongStructInterface is the interface met by GongStructs It allows runtime reflexion of instances (without the hassle of the "reflect" package)
type GongsimCommand ¶
type GongsimCommand struct { Name string Command GongsimCommandType CommandDate string SpeedCommandType SpeedCommandType DateSpeedCommand string Engine *Engine // contains filtered or unexported fields }
GongsimCommand is the struct of the instance that is updated by the front for issuing commands swagger:model GongsimCommand
func CopyBranchGongsimCommand ¶
func CopyBranchGongsimCommand(mapOrigCopy map[any]any, gongsimcommandFrom *GongsimCommand) (gongsimcommandTo *GongsimCommand)
func NewGongSimCommand ¶
func NewGongSimCommand(stage *StageStruct, engine *Engine) (gongsimCommand *GongsimCommand)
func (*GongsimCommand) Checkout ¶
func (gongsimcommand *GongsimCommand) Checkout(stage *StageStruct) *GongsimCommand
Checkout gongsimcommand to the back repo (if it is already staged)
func (*GongsimCommand) Commit ¶
func (gongsimcommand *GongsimCommand) Commit(stage *StageStruct) *GongsimCommand
commit gongsimcommand to the back repo (if it is already staged)
func (*GongsimCommand) CommitVoid ¶
func (gongsimcommand *GongsimCommand) CommitVoid(stage *StageStruct)
func (*GongsimCommand) CopyBasicFields ¶
func (from *GongsimCommand) CopyBasicFields(to *GongsimCommand)
func (*GongsimCommand) GetName ¶
func (gongsimcommand *GongsimCommand) GetName() (res string)
for satisfaction of GongStruct interface
func (*GongsimCommand) SetupGongsimThreads ¶
func (gongsimCommand *GongsimCommand) SetupGongsimThreads() *GongsimCommand
SetupGongsimThreads schedules gongsim threads
func (*GongsimCommand) Stage ¶
func (gongsimcommand *GongsimCommand) Stage(stage *StageStruct) *GongsimCommand
Stage puts gongsimcommand to the model stage
func (*GongsimCommand) Unstage ¶
func (gongsimcommand *GongsimCommand) Unstage(stage *StageStruct) *GongsimCommand
Unstage removes gongsimcommand off the model stage
func (*GongsimCommand) UnstageVoid ¶
func (gongsimcommand *GongsimCommand) UnstageVoid(stage *StageStruct)
UnstageVoid removes gongsimcommand off the model stage
type GongsimCommandType ¶
type GongsimCommandType string
swagger:enum GongsimCommandType
const ( COMMAND_PLAY GongsimCommandType = "PLAY" COMMAND_PAUSE GongsimCommandType = "PAUSE" COMMAND_FIRE_NEXT_EVENT GongsimCommandType = "FIRE_NEXT_EVENT" COMMAND_FIRE_EVENT_TILL_STATES_CHANGE GongsimCommandType = "FIRE_EVENT_TILL_STATES_CHANGE" COMMAND_RESET GongsimCommandType = "RESET" COMMAND_ADVANCE_10_MIN GongsimCommandType = "ADVANCE_10_MIN" )
values for EnumType
func (GongsimCommandType) CodeValues ¶
func (gongsimcommandtype GongsimCommandType) CodeValues() (res []string)
func (GongsimCommandType) Codes ¶
func (gongsimcommandtype GongsimCommandType) Codes() (res []string)
func (*GongsimCommandType) FromCodeString ¶
func (gongsimcommandtype *GongsimCommandType) FromCodeString(input string) (err error)
func (*GongsimCommandType) FromString ¶
func (gongsimcommandtype *GongsimCommandType) FromString(input string) (err error)
func (*GongsimCommandType) ToCodeString ¶
func (gongsimcommandtype *GongsimCommandType) ToCodeString() (res string)
func (GongsimCommandType) ToString ¶
func (gongsimcommandtype GongsimCommandType) ToString() (res string)
Utility function for GongsimCommandType if enum values are string, it is stored with the value if enum values are int, they are stored with the code of the value
type GongsimCommand_WOP ¶
type GongsimCommand_WOP struct { // insertion point Name string Command GongsimCommandType CommandDate string SpeedCommandType SpeedCommandType DateSpeedCommand string }
type GongsimStatus ¶
type GongsimStatus struct { Name string CurrentCommand GongsimCommandType CompletionDate string CurrentSpeedCommand SpeedCommandType SpeedCommandCompletionDate string }
GongsimStatus is the struct of the instance that is updated by the front for issuing Statuss swagger:model GongsimStatus
func CopyBranchGongsimStatus ¶
func CopyBranchGongsimStatus(mapOrigCopy map[any]any, gongsimstatusFrom *GongsimStatus) (gongsimstatusTo *GongsimStatus)
func (*GongsimStatus) Checkout ¶
func (gongsimstatus *GongsimStatus) Checkout(stage *StageStruct) *GongsimStatus
Checkout gongsimstatus to the back repo (if it is already staged)
func (*GongsimStatus) Commit ¶
func (gongsimstatus *GongsimStatus) Commit(stage *StageStruct) *GongsimStatus
commit gongsimstatus to the back repo (if it is already staged)
func (*GongsimStatus) CommitVoid ¶
func (gongsimstatus *GongsimStatus) CommitVoid(stage *StageStruct)
func (*GongsimStatus) CopyBasicFields ¶
func (from *GongsimStatus) CopyBasicFields(to *GongsimStatus)
func (*GongsimStatus) GetName ¶
func (gongsimstatus *GongsimStatus) GetName() (res string)
for satisfaction of GongStruct interface
func (*GongsimStatus) Stage ¶
func (gongsimstatus *GongsimStatus) Stage(stage *StageStruct) *GongsimStatus
Stage puts gongsimstatus to the model stage
func (*GongsimStatus) Unstage ¶
func (gongsimstatus *GongsimStatus) Unstage(stage *StageStruct) *GongsimStatus
Unstage removes gongsimstatus off the model stage
func (*GongsimStatus) UnstageVoid ¶
func (gongsimstatus *GongsimStatus) UnstageVoid(stage *StageStruct)
UnstageVoid removes gongsimstatus off the model stage
type GongsimStatus_WOP ¶
type GongsimStatus_WOP struct { // insertion point Name string CurrentCommand GongsimCommandType CompletionDate string CurrentSpeedCommand SpeedCommandType SpeedCommandCompletionDate string }
type Gongstruct ¶
type Gongstruct interface { // insertion point for generic types DummyAgent | Engine | Event | GongsimCommand | GongsimStatus }
Gongstruct is the type parameter for generated generic function that allows - access to staged instances - navigation between staged instances by going backward association links between gongstruct - full refactoring of Gongstruct identifiers / fields
type GongstructEnumIntField ¶
type GongstructEnumIntField interface { int | EngineDriverState | EngineRunMode | EngineStopMode Codes() []string CodeValues() []int }
type GongstructEnumStringField ¶
type GongstructEnumStringField interface { string | ControlMode | EngineState | GongsimCommandType | SpeedCommandType Codes() []string CodeValues() []string }
type GongstructMapString ¶
type GongstructMapString interface { map[any]any | map[string]*DummyAgent | map[string]*Engine | map[string]*Event | map[string]*GongsimCommand | map[string]*GongsimStatus | map[*any]any // because go does not support an extra "|" at the end of type specifications }
type GongstructSet ¶
type GongstructSet interface { map[any]any | map[*DummyAgent]any | map[*Engine]any | map[*Event]any | map[*GongsimCommand]any | map[*GongsimStatus]any | map[*any]any // because go does not support an extra "|" at the end of type specifications }
type GongtructBasicField ¶
type OnAfterCreateInterface ¶
type OnAfterCreateInterface[Type Gongstruct] interface { OnAfterCreate(stage *StageStruct, instance *Type) }
OnAfterCreateInterface callback when an instance is updated from the front
type OnAfterDeleteInterface ¶
type OnAfterDeleteInterface[Type Gongstruct] interface { OnAfterDelete(stage *StageStruct, staged, front *Type) }
OnAfterDeleteInterface callback when an instance is updated from the front
type OnAfterReadInterface ¶
type OnAfterReadInterface[Type Gongstruct] interface { OnAfterRead(stage *StageStruct, instance *Type) }
OnAfterReadInterface callback when an instance is updated from the front
type OnAfterUpdateInterface ¶
type OnAfterUpdateInterface[Type Gongstruct] interface { OnAfterUpdate(stage *StageStruct, old, new *Type) }
OnAfterUpdateInterface callback when an instance is updated from the front
type OnInitCommitInterface ¶
type OnInitCommitInterface interface {
BeforeCommit(stage *StageStruct)
}
type PointerToGongstruct ¶
type PointerToGongstruct interface { *DummyAgent | *Engine | *Event | *GongsimCommand | *GongsimStatus GetName() string CommitVoid(*StageStruct) UnstageVoid(stage *StageStruct) }
Gongstruct is the type parameter for generated generic function that allows - access to staged instances - navigation between staged instances by going backward association links between gongstruct - full refactoring of Gongstruct identifiers / fields
type PointerToGongstructEnumIntField ¶
type PointerToGongstructEnumIntField interface { *EngineDriverState | *EngineRunMode | *EngineStopMode FromCodeString(input string) (err error) }
type PointerToGongstructEnumStringField ¶
type PointerToGongstructEnumStringField interface { *ControlMode | *EngineState | *GongsimCommandType | *SpeedCommandType FromCodeString(input string) (err error) }
type ReverseField ¶
func GetReverseFields ¶
func GetReverseFields[Type Gongstruct]() (res []ReverseField)
type Simulation ¶
the simplest possible simulation
func (*Simulation) CheckoutAgents ¶
func (specificEngine *Simulation) CheckoutAgents(engine *Engine)
func (*Simulation) CommitAgents ¶
func (specificEngine *Simulation) CommitAgents(engine *Engine)
func (*Simulation) EventFired ¶
func (specificEngine *Simulation) EventFired(engine *Engine)
func (*Simulation) GetLastCommitNb ¶
func (specificEngine *Simulation) GetLastCommitNb() uint
func (*Simulation) GetLastCommitNbFromFront ¶
func (specificEngine *Simulation) GetLastCommitNbFromFront() uint
func (*Simulation) HasAnyStateChanged ¶
func (specificEngine *Simulation) HasAnyStateChanged(engine *Engine) bool
func (*Simulation) Reset ¶
func (specificEngine *Simulation) Reset(engine *Engine)
type SimulationInterface ¶
type SimulationInterface interface { // HasAnyStateChanged provides the generic engine infos about the behavior // of simulation // // It is used in order to have the "advance till one state changes" call // // the simulation shall implement this callback // it returns true if one state of the specific has changed HasAnyStateChanged(engine *Engine) bool // CommitAgents requests the simulation to commit the instances values to the back repo // // This is used when the simulation states has to be read by an outside component (the front component for instance) CommitAgents(engines *Engine) // CheckoutAgents requests the simulation to checkout the instances values from the back repo // // This is used when the simulation states has to be updated by values set by an outside component (the front component for instance) CheckoutAgents(engine *Engine) // GetLastCommitNb fetch the last commit nb from the simulation // this enables the engine to compute when it is necessary to update the stage following // updates to the back repo from the front GetLastCommitNb() uint // GetLastCommitNbFromFront fetch the last commit nb from the front to the simulation GetLastCommitNbFromFront() uint // Reset simulation Reset(engine *Engine) }
SimulationInterface is the callback support for events that happens on the generic engine
type SpeedCommandType ¶
type SpeedCommandType string
swagger:enum GongsimCommandType
const ( COMMAND_INCREASE_SPEED_100_PERCENTS SpeedCommandType = "INCREASE_SPEED_100_PERCENTS" COMMAND_DECREASE_SPEED_50_PERCENTS SpeedCommandType = "COMMAND_DECREASE_SPEED_50_PERCENTS " COMMAND_SPEED_STEADY SpeedCommandType = "COMMAND_SPEED_STEADY" )
func (SpeedCommandType) CodeValues ¶
func (speedcommandtype SpeedCommandType) CodeValues() (res []string)
func (SpeedCommandType) Codes ¶
func (speedcommandtype SpeedCommandType) Codes() (res []string)
func (*SpeedCommandType) FromCodeString ¶
func (speedcommandtype *SpeedCommandType) FromCodeString(input string) (err error)
func (*SpeedCommandType) FromString ¶
func (speedcommandtype *SpeedCommandType) FromString(input string) (err error)
func (*SpeedCommandType) ToCodeString ¶
func (speedcommandtype *SpeedCommandType) ToCodeString() (res string)
func (SpeedCommandType) ToString ¶
func (speedcommandtype SpeedCommandType) ToString() (res string)
Utility function for SpeedCommandType if enum values are string, it is stored with the value if enum values are int, they are stored with the code of the value
type StageStruct ¶
type StageStruct struct { // insertion point for definition of arrays registering instances DummyAgents map[*DummyAgent]any DummyAgents_mapString map[string]*DummyAgent OnAfterDummyAgentCreateCallback OnAfterCreateInterface[DummyAgent] OnAfterDummyAgentUpdateCallback OnAfterUpdateInterface[DummyAgent] OnAfterDummyAgentDeleteCallback OnAfterDeleteInterface[DummyAgent] OnAfterDummyAgentReadCallback OnAfterReadInterface[DummyAgent] Engines map[*Engine]any Engines_mapString map[string]*Engine OnAfterEngineCreateCallback OnAfterCreateInterface[Engine] OnAfterEngineUpdateCallback OnAfterUpdateInterface[Engine] OnAfterEngineDeleteCallback OnAfterDeleteInterface[Engine] OnAfterEngineReadCallback OnAfterReadInterface[Engine] Events map[*Event]any Events_mapString map[string]*Event OnAfterEventCreateCallback OnAfterCreateInterface[Event] OnAfterEventUpdateCallback OnAfterUpdateInterface[Event] OnAfterEventDeleteCallback OnAfterDeleteInterface[Event] OnAfterEventReadCallback OnAfterReadInterface[Event] GongsimCommands map[*GongsimCommand]any GongsimCommands_mapString map[string]*GongsimCommand OnAfterGongsimCommandCreateCallback OnAfterCreateInterface[GongsimCommand] OnAfterGongsimCommandUpdateCallback OnAfterUpdateInterface[GongsimCommand] OnAfterGongsimCommandDeleteCallback OnAfterDeleteInterface[GongsimCommand] OnAfterGongsimCommandReadCallback OnAfterReadInterface[GongsimCommand] GongsimStatuss map[*GongsimStatus]any GongsimStatuss_mapString map[string]*GongsimStatus OnAfterGongsimStatusCreateCallback OnAfterCreateInterface[GongsimStatus] OnAfterGongsimStatusUpdateCallback OnAfterUpdateInterface[GongsimStatus] OnAfterGongsimStatusDeleteCallback OnAfterDeleteInterface[GongsimStatus] OnAfterGongsimStatusReadCallback OnAfterReadInterface[GongsimStatus] AllModelsStructCreateCallback AllModelsStructCreateInterface AllModelsStructDeleteCallback AllModelsStructDeleteInterface BackRepo BackRepoInterface // if set will be called before each commit to the back repo OnInitCommitCallback OnInitCommitInterface OnInitCommitFromFrontCallback OnInitCommitInterface OnInitCommitFromBackCallback OnInitCommitInterface // store the number of instance per gongstruct Map_GongStructName_InstancesNb map[string]int // store meta package import MetaPackageImportPath string MetaPackageImportAlias string // to be removed after fix of [issue](https://github.com/golang/go/issues/57559) // map to enable docLink renaming when an identifier is renamed Map_DocLink_Renaming map[string]GONG__Identifier // contains filtered or unexported fields }
StageStruct enables storage of staged instances swagger:ignore
func NewStage ¶
func NewStage(path string) (stage *StageStruct)
func (*StageStruct) Backup ¶
func (stage *StageStruct) Backup(dirPath string)
backup generates backup files in the dirPath
func (*StageStruct) BackupXL ¶
func (stage *StageStruct) BackupXL(dirPath string)
backup generates backup files in the dirPath
func (*StageStruct) Checkout ¶
func (stage *StageStruct) Checkout()
func (*StageStruct) Commit ¶
func (stage *StageStruct) Commit()
func (*StageStruct) CommitWithSuspendedCallbacks ¶
func (stage *StageStruct) CommitWithSuspendedCallbacks()
func (*StageStruct) ComputeReverseMaps ¶
func (stage *StageStruct) ComputeReverseMaps()
ComputeReverseMaps computes the reverse map, for all intances, for all slice to pointers field Its complexity is in O(n)O(p) where p is the number of pointers
func (*StageStruct) GetPath ¶
func (stage *StageStruct) GetPath() string
func (*StageStruct) GetType ¶
func (stage *StageStruct) GetType() string
func (*StageStruct) IsStagedDummyAgent ¶
func (stage *StageStruct) IsStagedDummyAgent(dummyagent *DummyAgent) (ok bool)
insertion point for stage per struct
func (*StageStruct) IsStagedEngine ¶
func (stage *StageStruct) IsStagedEngine(engine *Engine) (ok bool)
func (*StageStruct) IsStagedEvent ¶
func (stage *StageStruct) IsStagedEvent(event *Event) (ok bool)
func (*StageStruct) IsStagedGongsimCommand ¶
func (stage *StageStruct) IsStagedGongsimCommand(gongsimcommand *GongsimCommand) (ok bool)
func (*StageStruct) IsStagedGongsimStatus ¶
func (stage *StageStruct) IsStagedGongsimStatus(gongsimstatus *GongsimStatus) (ok bool)
func (*StageStruct) Marshall ¶
func (stage *StageStruct) Marshall(file *os.File, modelsPackageName, packageName string)
Marshall marshall the stage content into the file as an instanciation into a stage
func (*StageStruct) Nil ¶
func (stage *StageStruct) Nil()
func (*StageStruct) Reset ¶
func (stage *StageStruct) Reset()
func (*StageStruct) Restore ¶
func (stage *StageStruct) Restore(dirPath string)
Restore resets Stage & BackRepo and restores their content from the restore files in dirPath
func (*StageStruct) RestoreXL ¶
func (stage *StageStruct) RestoreXL(dirPath string)
Restore resets Stage & BackRepo and restores their content from the restore files in dirPath
func (*StageStruct) StageBranchDummyAgent ¶
func (stage *StageStruct) StageBranchDummyAgent(dummyagent *DummyAgent)
insertion point for stage branch per struct
func (*StageStruct) StageBranchEngine ¶
func (stage *StageStruct) StageBranchEngine(engine *Engine)
func (*StageStruct) StageBranchEvent ¶
func (stage *StageStruct) StageBranchEvent(event *Event)
func (*StageStruct) StageBranchGongsimCommand ¶
func (stage *StageStruct) StageBranchGongsimCommand(gongsimcommand *GongsimCommand)
func (*StageStruct) StageBranchGongsimStatus ¶
func (stage *StageStruct) StageBranchGongsimStatus(gongsimstatus *GongsimStatus)
func (*StageStruct) Unstage ¶
func (stage *StageStruct) Unstage()
func (*StageStruct) UnstageBranchDummyAgent ¶
func (stage *StageStruct) UnstageBranchDummyAgent(dummyagent *DummyAgent)
insertion point for unstage branch per struct
func (*StageStruct) UnstageBranchEngine ¶
func (stage *StageStruct) UnstageBranchEngine(engine *Engine)
func (*StageStruct) UnstageBranchEvent ¶
func (stage *StageStruct) UnstageBranchEvent(event *Event)
func (*StageStruct) UnstageBranchGongsimCommand ¶
func (stage *StageStruct) UnstageBranchGongsimCommand(gongsimcommand *GongsimCommand)
func (*StageStruct) UnstageBranchGongsimStatus ¶
func (stage *StageStruct) UnstageBranchGongsimStatus(gongsimstatus *GongsimStatus)
type Tabulator ¶
type Tabulator interface { AddSheet(sheetName string) AddRow(sheetName string) int AddCell(sheetName string, rowId, columnIndex int, value string) }
Tabulator is an interface for writing to a table strings
type UpdateState ¶
type UpdateState struct { Event // Period is the time between two fires of FireTime Period time.Duration }
UpdateState is an event whose role is to ask the agant to compute its new vector state swagger:model UpdateState
Source Files ¶
- agent.go
- docs.go
- engine.go
- engine_driver_stage_enum.go
- engine_run_mode_enum.go
- engine_singloton.go
- engine_stop_mode_enum.go
- event.go
- gong.go
- gong_ast.go
- gong_callbacks.go
- gong_enum.go
- gong_graph.go
- gong_marshall.go
- gong_orchestrator.go
- gong_serialize.go
- gong_slices.go
- gong_wop.go
- gongsim_command.go
- gongsim_command_checkout_scheduler.go
- gongsim_command_command_pooler.go
- gongsim_command_commit_scheduler.go
- gongsim_command_type.go
- gongsim_command_watcher.go
- gongsim_status.go
- simulation.go
- simulation_interface.go
- speed_command_type.go
- updatestate.go