aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-22 14:00:41 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-22 14:00:41 +0200
commitbc02054d56118110a36aea72d21f9d5e73d07d1f (patch)
tree2fc49dd3f93307df6242b8e63bca0e26b2e62168 /docs
parentfab0fccc0aaa18e915bcd08e81e5a04177e435cd (diff)
refactor file reading factory
Diffstat (limited to 'docs')
-rw-r--r--docs/class-diag.puml69
1 files changed, 42 insertions, 27 deletions
diff --git a/docs/class-diag.puml b/docs/class-diag.puml
index 8058e0a..6c38d9c 100644
--- a/docs/class-diag.puml
+++ b/docs/class-diag.puml
@@ -18,29 +18,31 @@ exception Exception {
}
rectangle Group_FileReading as "File reading" <<group>> {
- class FileReaderFactory <<Factory>> {
- + open(url) : FileReader&
+ class FileReaderFactory <<factory>> {
+ + create(url : const string &) : uniq<FileReader>
}
interface FileReader {
- + read() : string
+ # FileReader(url : const string &)
+ + ~FileReader()
+ --
+ # open()
+ + read() : const string
+ close()
--
- # open(string url)
- # clone() : FileReader* <<const>>
+ # url : const string
}
class LocalFileReader {
- - instance : LocalFileReader <<static>>
+ + ~LocalFileReader()
}
class HTTPFileReader {
- - instance : HTTPFileReader <<static>>
}
package CPR { }
- FileReader <|.u. LocalFileReader
- FileReader <|.u. HTTPFileReader
+ FileReader <|.d. LocalFileReader
+ FileReader <|.d. HTTPFileReader
- FileReader .l> FileReaderFactory
- FileReader <. FileReaderFactory
+ FileReaderFactory -u-> LocalFileReader
+ FileReaderFactory -u-> HTTPFileReader
HTTPFileReader -l> CPR
@@ -59,20 +61,21 @@ rectangle Group_ParsingDeserialization as "Parsing & deserialization" <<group>>
+ heuristic(FileReader &) : unsigned int <<static>>
}
- Parser .> ParserFactory
- Parser <. ParserFactory
-
- class CSVParser
class XMLParser
class TXTParser
+ class CSVParser
package pugixml { }
- CSVParser ..|> Parser
- TXTParser ..|> Parser
- XMLParser ..|> Parser
+ Parser <|.d. XMLParser
+ Parser <|.d. TXTParser
+ Parser <|.d. CSVParser
+
+ ParserFactory -u-> XMLParser
+ ParserFactory -u-> TXTParser
+ ParserFactory -u-> CSVParser
- XMLParser -> pugixml
+ XMLParser -r> pugixml
class MuseumDeserializer {
+ MuseumDeserializer(Museum &)
@@ -135,6 +138,7 @@ rectangle Group_Model as "Model" <<group>> {
- worker : thread *
- work()
}
+ together {
class Canvas {
+ Canvas(Museum &)
--
@@ -148,6 +152,10 @@ rectangle Group_Model as "Model" <<group>> {
- tiles : vector<Tile *>
- museum : Museum &
}
+ struct CanvasData {
+ + rows : unsigned int
+ + columns : unsigned int
+ }
class People {
+ People(Museum &)
--
@@ -159,6 +167,8 @@ rectangle Group_Model as "Model" <<group>> {
- artist_count : size_t
- museum : Museum &
}
+ }
+ together {
class Tile {
+ data : TileData
+ color : Color
@@ -190,11 +200,9 @@ rectangle Group_Model as "Model" <<group>> {
+ vx : float
+ vy : float
}
- struct CanvasData {
- + rows : unsigned int
- + columns : unsigned int
}
+ together {
struct Color {
red : unsigned int
green : unsigned int
@@ -204,7 +212,9 @@ rectangle Group_Model as "Model" <<group>> {
+ get_color(string) : Color <<static>>
+ register_color(string, Color) <<static>>
}
+ }
+ together {
interface TileBehavior {
+ step(Artist *)
+ update(Tile &)
@@ -214,13 +224,13 @@ rectangle Group_Model as "Model" <<group>> {
# interactions : unsigned int
# museum : Museum &
}
-
class TileBehaviorFactory {
+ TileBehaviorFactory(Museum &)
+ create(string) : uniq<TileBehavior>
--
- museum : Museum &
}
+ }
together {
class NullTileBehavior {
@@ -243,8 +253,15 @@ rectangle Group_Model as "Model" <<group>> {
--
- last_interactions : unsigned int
}
+
+ NullTileBehavior -d[hidden]- StepTileBehavior
+ StepTileBehavior -d[hidden]- DeleteArtistTileBehavior
+ DeleteArtistTileBehavior -d[hidden]- SetNeighborTileBehavior
+ SetNeighborTileBehavior -d[hidden]- CreateArtistTileBehavior
}
+ Canvas -l[hidden] People
+
Museum --> People
Museum --> Canvas
@@ -258,7 +275,7 @@ rectangle Group_Model as "Model" <<group>> {
Tile --> "state" Color
Tile .[norank].> TileColorFactory
- TileColorFactory .> Color
+ TileColorFactory -> Color
TileBehavior <|.. NullTileBehavior
TileBehavior <|.. StepTileBehavior
@@ -275,9 +292,6 @@ rectangle Group_Model as "Model" <<group>> {
Tile --> "state" TileBehavior
Tile .[norank].> TileBehaviorFactory
- TileBehaviorFactory .l> TileBehavior
- TileBehaviorFactory <. TileBehavior
-
' LAYOUT
Artist -r[hidden] Tile
}
@@ -378,6 +392,7 @@ rectangle Group_Commands as "Commands" <<group>> {
} /' LAYOUT '/
Parser .l> FileReader
+' Parser -l> FileReaderFactory
MuseumDeserializer .l> Museum
Museum --> PathfindingContext