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 ReplaceOldDeclarationsInFile(pathToFile string) 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 Command
- func (command *Command) Checkout(stage *StageStruct) *Command
- func (command *Command) Commit(stage *StageStruct) *Command
- func (command *Command) CommitVoid(stage *StageStruct)
- func (from *Command) CopyBasicFields(to *Command)
- func (command *Command) GetName() (res string)
- func (command *Command) OnAfterUpdate(stage *StageStruct, stagedCommand, frontCommand *Command)
- func (command *Command) SetupGongsimThreads() *Command
- func (command *Command) Stage(stage *StageStruct) *Command
- func (command *Command) Unstage(stage *StageStruct) *Command
- func (command *Command) UnstageVoid(stage *StageStruct)
- type CommandOrchestrator
- type CommandType
- func (commandtype CommandType) CodeValues() (res []string)
- func (commandtype CommandType) Codes() (res []string)
- func (commandtype *CommandType) FromCodeString(input string) (err error)
- func (commandtype *CommandType) FromString(input string) (err error)
- func (commandtype *CommandType) ToCodeString() (res string)
- func (commandtype CommandType) ToString() (res string)
- type Command_WOP
- 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 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) IsStagedCommand(command *Command) (ok bool)
- 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) IsStagedStatus(status *Status) (ok bool)
- func (stage *StageStruct) IsStagedUpdateState(updatestate *UpdateState) (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) StageBranchCommand(command *Command)
- func (stage *StageStruct) StageBranchDummyAgent(dummyagent *DummyAgent)
- func (stage *StageStruct) StageBranchEngine(engine *Engine)
- func (stage *StageStruct) StageBranchEvent(event *Event)
- func (stage *StageStruct) StageBranchStatus(status *Status)
- func (stage *StageStruct) StageBranchUpdateState(updatestate *UpdateState)
- func (stage *StageStruct) Unstage()
- func (stage *StageStruct) UnstageBranchCommand(command *Command)
- func (stage *StageStruct) UnstageBranchDummyAgent(dummyagent *DummyAgent)
- func (stage *StageStruct) UnstageBranchEngine(engine *Engine)
- func (stage *StageStruct) UnstageBranchEvent(event *Event)
- func (stage *StageStruct) UnstageBranchStatus(status *Status)
- func (stage *StageStruct) UnstageBranchUpdateState(updatestate *UpdateState)
- type Status
- func (status *Status) Checkout(stage *StageStruct) *Status
- func (status *Status) Commit(stage *StageStruct) *Status
- func (status *Status) CommitVoid(stage *StageStruct)
- func (from *Status) CopyBasicFields(to *Status)
- func (status *Status) GetName() (res string)
- func (status *Status) Stage(stage *StageStruct) *Status
- func (status *Status) Unstage(stage *StageStruct) *Status
- func (status *Status) UnstageVoid(stage *StageStruct)
- type Status_WOP
- type Tabulator
- type UpdateState
- func (updatestate *UpdateState) Checkout(stage *StageStruct) *UpdateState
- func (updatestate *UpdateState) Commit(stage *StageStruct) *UpdateState
- func (updatestate *UpdateState) CommitVoid(stage *StageStruct)
- func (from *UpdateState) CopyBasicFields(to *UpdateState)
- func (updatestate *UpdateState) GetName() (res string)
- func (updatestate *UpdateState) Stage(stage *StageStruct) *UpdateState
- func (updatestate *UpdateState) Unstage(stage *StageStruct) *UpdateState
- func (updatestate *UpdateState) UnstageVoid(stage *StageStruct)
- type UpdateState_WOP
Constants ¶
const IdentifiersDecls = `
{{Identifier}} := (&models.{{GeneratedStructName}}{}).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 ReplaceOldDeclarationsInFile ¶
ReplaceOldDeclarationsInFile replaces specific text in a file at the given path.
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 { CreateORMCommand(Command *Command) CreateORMDummyAgent(DummyAgent *DummyAgent) CreateORMEngine(Engine *Engine) CreateORMEvent(Event *Event) CreateORMStatus(Status *Status) CreateORMUpdateState(UpdateState *UpdateState) }
swagger:ignore
type AllModelsStructDeleteInterface ¶
type AllModelsStructDeleteInterface interface { DeleteORMCommand(Command *Command) DeleteORMDummyAgent(DummyAgent *DummyAgent) DeleteORMEngine(Engine *Engine) DeleteORMEvent(Event *Event) DeleteORMStatus(Status *Status) DeleteORMUpdateState(UpdateState *UpdateState) }
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 CommitCommand(command *Command) CheckoutCommand(command *Command) CommitDummyAgent(dummyagent *DummyAgent) CheckoutDummyAgent(dummyagent *DummyAgent) CommitEngine(engine *Engine) CheckoutEngine(engine *Engine) CommitEvent(event *Event) CheckoutEvent(event *Event) CommitStatus(status *Status) CheckoutStatus(status *Status) CommitUpdateState(updatestate *UpdateState) CheckoutUpdateState(updatestate *UpdateState) GetLastCommitFromBackNb() uint GetLastPushFromFrontNb() uint }
type Command ¶
type Command struct { Name string Command CommandType CommandDate string Engine *Engine // contains filtered or unexported fields }
Command is the struct of the instance that is updated by the front for issuing commands swagger:model Command
func CopyBranchCommand ¶
insertion point for stage branch per struct
func NewCommand ¶
func NewCommand(stage *StageStruct, engine *Engine) (command *Command)
func (*Command) Checkout ¶
func (command *Command) Checkout(stage *StageStruct) *Command
Checkout command to the back repo (if it is already staged)
func (*Command) Commit ¶
func (command *Command) Commit(stage *StageStruct) *Command
commit command to the back repo (if it is already staged)
func (*Command) CommitVoid ¶
func (command *Command) CommitVoid(stage *StageStruct)
func (*Command) CopyBasicFields ¶
func (*Command) OnAfterUpdate ¶
func (command *Command) OnAfterUpdate(stage *StageStruct, stagedCommand, frontCommand *Command)
func (*Command) SetupGongsimThreads ¶
SetupGongsimThreads schedules gongsim threads
func (*Command) Stage ¶
func (command *Command) Stage(stage *StageStruct) *Command
insertion point for cumulative sub template with model space calls Stage puts command to the model stage
func (*Command) Unstage ¶
func (command *Command) Unstage(stage *StageStruct) *Command
Unstage removes command off the model stage
func (*Command) UnstageVoid ¶
func (command *Command) UnstageVoid(stage *StageStruct)
UnstageVoid removes command off the model stage
type CommandOrchestrator ¶
type CommandOrchestrator struct { }
insertion point CommandOrchestrator
func (*CommandOrchestrator) OnAfterUpdate ¶
func (orchestrator *CommandOrchestrator) OnAfterUpdate( gongsvgStage *StageStruct, stagedCommand, backRepoCommand *Command)
type CommandType ¶
type CommandType string
swagger:enum CommandType
const ( COMMAND_PLAY CommandType = "PLAY" COMMAND_PAUSE CommandType = "PAUSE" COMMAND_FIRE_NEXT_EVENT CommandType = "FIRE_NEXT_EVENT" COMMAND_FIRE_EVENT_TILL_STATES_CHANGE CommandType = "FIRE_EVENT_TILL_STATES_CHANGE" COMMAND_RESET CommandType = "RESET" COMMAND_ADVANCE_10_MIN CommandType = "ADVANCE_10_MIN" INCREASE_SPEED_100_PERCENTS CommandType = "INCREASE_SPEED_100_PERCENTS" DECREASE_SPEED_50_PERCENTS CommandType = "DECREASE_SPEED_50_PERCENTS" )
values for EnumType
func (CommandType) CodeValues ¶
func (commandtype CommandType) CodeValues() (res []string)
func (CommandType) Codes ¶
func (commandtype CommandType) Codes() (res []string)
func (*CommandType) FromCodeString ¶
func (commandtype *CommandType) FromCodeString(input string) (err error)
func (*CommandType) FromString ¶
func (commandtype *CommandType) FromString(input string) (err error)
func (*CommandType) ToCodeString ¶
func (commandtype *CommandType) ToCodeString() (res string)
func (CommandType) ToString ¶
func (commandtype CommandType) ToString() (res string)
insertion point of enum utility functions Utility function for CommandType 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 Command_WOP ¶
type Command_WOP struct { // insertion point Name string Command CommandType CommandDate string }
insertion point
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)
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)
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
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 ¶
type Engine ¶
type Engine struct { // Name of the engine "laundramat" for instance Name string EndTime string CurrentTime string DisplayFormat 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 DisplayFormat 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 Gongstruct ¶
type Gongstruct interface { }
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 GongstructMapString ¶
type GongstructSet ¶
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 { GetName() string CommitVoid(*StageStruct) UnstageVoid(stage *StageStruct) comparable }
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 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 Commands map[*Command]any Commands_mapString map[string]*Command // insertion point for slice of pointers maps OnAfterCommandCreateCallback OnAfterCreateInterface[Command] OnAfterCommandUpdateCallback OnAfterUpdateInterface[Command] OnAfterCommandDeleteCallback OnAfterDeleteInterface[Command] OnAfterCommandReadCallback OnAfterReadInterface[Command] DummyAgents map[*DummyAgent]any DummyAgents_mapString map[string]*DummyAgent // insertion point for slice of pointers maps OnAfterDummyAgentCreateCallback OnAfterCreateInterface[DummyAgent] OnAfterDummyAgentUpdateCallback OnAfterUpdateInterface[DummyAgent] OnAfterDummyAgentDeleteCallback OnAfterDeleteInterface[DummyAgent] OnAfterDummyAgentReadCallback OnAfterReadInterface[DummyAgent] Engines map[*Engine]any Engines_mapString map[string]*Engine // insertion point for slice of pointers maps OnAfterEngineCreateCallback OnAfterCreateInterface[Engine] OnAfterEngineUpdateCallback OnAfterUpdateInterface[Engine] OnAfterEngineDeleteCallback OnAfterDeleteInterface[Engine] OnAfterEngineReadCallback OnAfterReadInterface[Engine] Events map[*Event]any Events_mapString map[string]*Event // insertion point for slice of pointers maps OnAfterEventCreateCallback OnAfterCreateInterface[Event] OnAfterEventUpdateCallback OnAfterUpdateInterface[Event] OnAfterEventDeleteCallback OnAfterDeleteInterface[Event] OnAfterEventReadCallback OnAfterReadInterface[Event] Statuss map[*Status]any Statuss_mapString map[string]*Status // insertion point for slice of pointers maps OnAfterStatusCreateCallback OnAfterCreateInterface[Status] OnAfterStatusUpdateCallback OnAfterUpdateInterface[Status] OnAfterStatusDeleteCallback OnAfterDeleteInterface[Status] OnAfterStatusReadCallback OnAfterReadInterface[Status] UpdateStates map[*UpdateState]any UpdateStates_mapString map[string]*UpdateState // insertion point for slice of pointers maps OnAfterUpdateStateCreateCallback OnAfterCreateInterface[UpdateState] OnAfterUpdateStateUpdateCallback OnAfterUpdateInterface[UpdateState] OnAfterUpdateStateDeleteCallback OnAfterDeleteInterface[UpdateState] OnAfterUpdateStateReadCallback OnAfterReadInterface[UpdateState] 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) IsStagedCommand ¶
func (stage *StageStruct) IsStagedCommand(command *Command) (ok bool)
insertion point for stage per struct
func (*StageStruct) IsStagedDummyAgent ¶
func (stage *StageStruct) IsStagedDummyAgent(dummyagent *DummyAgent) (ok bool)
func (*StageStruct) IsStagedEngine ¶
func (stage *StageStruct) IsStagedEngine(engine *Engine) (ok bool)
func (*StageStruct) IsStagedEvent ¶
func (stage *StageStruct) IsStagedEvent(event *Event) (ok bool)
func (*StageStruct) IsStagedStatus ¶
func (stage *StageStruct) IsStagedStatus(status *Status) (ok bool)
func (*StageStruct) IsStagedUpdateState ¶
func (stage *StageStruct) IsStagedUpdateState(updatestate *UpdateState) (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) StageBranchCommand ¶
func (stage *StageStruct) StageBranchCommand(command *Command)
insertion point for stage branch per struct
func (*StageStruct) StageBranchDummyAgent ¶
func (stage *StageStruct) StageBranchDummyAgent(dummyagent *DummyAgent)
func (*StageStruct) StageBranchEngine ¶
func (stage *StageStruct) StageBranchEngine(engine *Engine)
func (*StageStruct) StageBranchEvent ¶
func (stage *StageStruct) StageBranchEvent(event *Event)
func (*StageStruct) StageBranchStatus ¶
func (stage *StageStruct) StageBranchStatus(status *Status)
func (*StageStruct) StageBranchUpdateState ¶
func (stage *StageStruct) StageBranchUpdateState(updatestate *UpdateState)
func (*StageStruct) Unstage ¶
func (stage *StageStruct) Unstage()
func (*StageStruct) UnstageBranchCommand ¶
func (stage *StageStruct) UnstageBranchCommand(command *Command)
insertion point for unstage branch per struct
func (*StageStruct) UnstageBranchDummyAgent ¶
func (stage *StageStruct) UnstageBranchDummyAgent(dummyagent *DummyAgent)
func (*StageStruct) UnstageBranchEngine ¶
func (stage *StageStruct) UnstageBranchEngine(engine *Engine)
func (*StageStruct) UnstageBranchEvent ¶
func (stage *StageStruct) UnstageBranchEvent(event *Event)
func (*StageStruct) UnstageBranchStatus ¶
func (stage *StageStruct) UnstageBranchStatus(status *Status)
func (*StageStruct) UnstageBranchUpdateState ¶
func (stage *StageStruct) UnstageBranchUpdateState(updatestate *UpdateState)
type Status ¶
type Status struct { Name string CurrentCommand CommandType CompletionDate string CurrentSpeedCommand SpeedCommandType SpeedCommandCompletionDate string }
Status is the struct of the instance that is updated by the front for issuing Statuss swagger:model Status
func CopyBranchStatus ¶
func (*Status) Checkout ¶
func (status *Status) Checkout(stage *StageStruct) *Status
Checkout status to the back repo (if it is already staged)
func (*Status) Commit ¶
func (status *Status) Commit(stage *StageStruct) *Status
commit status to the back repo (if it is already staged)
func (*Status) CommitVoid ¶
func (status *Status) CommitVoid(stage *StageStruct)
func (*Status) CopyBasicFields ¶
func (*Status) Stage ¶
func (status *Status) Stage(stage *StageStruct) *Status
Stage puts status to the model stage
func (*Status) Unstage ¶
func (status *Status) Unstage(stage *StageStruct) *Status
Unstage removes status off the model stage
func (*Status) UnstageVoid ¶
func (status *Status) UnstageVoid(stage *StageStruct)
UnstageVoid removes status off the model stage
type Status_WOP ¶
type Status_WOP struct { // insertion point Name string CurrentCommand CommandType CompletionDate string CurrentSpeedCommand SpeedCommandType SpeedCommandCompletionDate string }
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
func CopyBranchUpdateState ¶
func CopyBranchUpdateState(mapOrigCopy map[any]any, updatestateFrom *UpdateState) (updatestateTo *UpdateState)
func (*UpdateState) Checkout ¶
func (updatestate *UpdateState) Checkout(stage *StageStruct) *UpdateState
Checkout updatestate to the back repo (if it is already staged)
func (*UpdateState) Commit ¶
func (updatestate *UpdateState) Commit(stage *StageStruct) *UpdateState
commit updatestate to the back repo (if it is already staged)
func (*UpdateState) CommitVoid ¶
func (updatestate *UpdateState) CommitVoid(stage *StageStruct)
func (*UpdateState) CopyBasicFields ¶
func (from *UpdateState) CopyBasicFields(to *UpdateState)
func (*UpdateState) GetName ¶
func (updatestate *UpdateState) GetName() (res string)
for satisfaction of GongStruct interface
func (*UpdateState) Stage ¶
func (updatestate *UpdateState) Stage(stage *StageStruct) *UpdateState
Stage puts updatestate to the model stage
func (*UpdateState) Unstage ¶
func (updatestate *UpdateState) Unstage(stage *StageStruct) *UpdateState
Unstage removes updatestate off the model stage
func (*UpdateState) UnstageVoid ¶
func (updatestate *UpdateState) UnstageVoid(stage *StageStruct)
UnstageVoid removes updatestate off the model stage
Source Files ¶
- agent.go
- command.go
- command_checkout_scheduler.go
- command_commit_scheduler.go
- command_on_after_update.go
- command_type.go
- command_watcher.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_status.go
- simulation.go
- simulation_interface.go
- speed_command_type.go
- updatestate.go