본문 바로가기
architecture

[My cheat-sheet] PUML

by kanlee2010 2021. 9. 29.

참고 : http://www.plantuml.com/plantuml/uml

usecase

@startuml usecase_diagram
title AM3352 IG Use Cases

left to right direction
actor LSM #blue
package Init {
    usecase "Init IG FPGA" as Init_UC1
}
package SwUpdate {
    usecase "Self Update" as SwUpdate_UC1
    usecase "Forward\n FPGA binary" as SwUpdate_UC2
}
LSM --> SwUpdate_UC1
LSM --> SwUpdate_UC2
@enduml

class

@startuml
skinparam classAttributeIconSize 0
hide circle
hide methods

abstract Employee <<abstract>> {
    +ssNoint
    +nameString
    +emailString
    +counterint
}
class "Research\n Associate" as RA
Employee <|-- "Administrative\n Employee"
Employee <|-- RA
RA : +fieldOfStudyString
RA <|-- Lecturer
RA "1..*" -- "0..*Project
(RAProject.. Participation
Participation : +hoursint
Lecturer "1..*" -- "1..*Course : teaches >
Employee "1 +dean" - "0..1Faculty : leads >
Faculty : +nameString
Faculty "1" *-- "1..*Institure
Institure : +nameString
Institure : +addressString
Institure "1..*" o-- "1..*RA
class Course {
    +nameString
    +idint
    +hoursfloat
}
class Project {
    +nameString
    +startDate
    +endDate
}
@enduml
@startuml

skinparam linetype ortho
hide empty members
hide empty method

abstract ModelExecuter {
    {static} Create(model_loc: string, type: EngineEnumType)
    {abstract} bool Execute()
}
ModelExecuter <|-- GPUExecuter

@enduml

sequence

@startuml
hide footbox
loop (15incorrect PW
":Student" -> ":Admin System" : login(ID, PW)
return login result
end
break incorrect PW
":Admin System" -> ":Student" : error message
end
alt correct PW
":Admin System" -> ":Student" : welcome message
end
":Student" -> ":Admin System" : enroll()
return OK
@enduml
@startuml sequence_diagram
hide footbox
actor Power #red
Power -> MainLoop ++ : main()
create pthEthSwitch
MainLoop -> pthEthSwitch: pthread_create
@enduml

statechart

@startuml state_diagram
[*] --> Idle
Idle : entry / amount := 0
Idle : do / display(greeting)
Idle --> Accumulate : insert(c:Coin)
Accumulate : entry / amount := amount+c.amount
Accumulate : do / display(amount)
Accumulate --> Vend : select(i:item)
Accumulate --> Accumulate : insert(c:Coin)
Vend --> Idle : [else]

state keyboard {
    [*] -> default
    default -> default : ANY_KEY
    default --> caps_locked : CAPS_LOCK
    caps_locked --> default : CAPS_LOCK
    caps_locked -> caps_locked : ANY_KEY
    ||
    [*] -> numbers
    numbers -> numbers : NUM_KEY
    numbers --> arrows : NUM_LOCK
    arrows --> numbers : NUM_LOCK
    arrows -> arrows : NUM_KEY
}
@enduml

activity

@startuml activity_diagram
(*) --> "Add a New Client"
"Add a New Client" --> "Assign Staff Contact"
if "" then
    --> [campaign to add] "Add New Campaign"
    "Add New Campaign" --> (*)
else
    --> [no campaign to add] (*)
@enduml

component

@startuml component_diagram
package domain {
    node entity {
        component update_info
    }
}

package application {
    component MainLoop
}

update_info <-- MainLoop

package porting_interface {
    [MainLoop--> LedDriver
    LedDriver - [LedImpl]
}

package "iwa/libproduct.so" as iwa_product {
    LedDriver <-- [Fpga]
}
@enduml

 

 

'architecture' 카테고리의 다른 글

observer design pattern example  (0) 2022.11.29
composite design pattern example  (0) 2022.11.29
[My cheat-sheet] Design Patterns  (0) 2021.07.03

댓글