Skip to content

Commit

Permalink
Add default services flag support on constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin.lesage committed Apr 12, 2024
1 parent 098c081 commit f2006f6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,19 @@ trait BaseHardwareNodeBuilder[T <: Hardware] extends PMLNodeBuilder[T] {
def apply(name: Symbol)(implicit p: ProvideRelation[Hardware, Service],
owner: Owner): T =
apply(name, Set.empty, true)


/**
* A physical component can be defined only its name, the services will be defined by default
*
* @group publicConstructor
* @param name the physical component name
* @param withDefaultServices add default Load/Store services on creation
* @param p implicitly retrieved relation linking components to their provided services
* @param owner implicitly retrieved name of the platform
* @return the physical component
*/
def apply(name: Symbol, withDefaultServices: Boolean)(implicit p: ProvideRelation[Hardware, Service],
owner: Owner): T =
apply(name, Set.empty, withDefaultServices)
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class HardwareTest extends AnyFlatSpec with should.Matchers {

val i = Target(Set.empty, false)
i.services.size shouldEqual 0

val j = Target(Symbol("j"), false)
j.services.size shouldEqual 0
}

}

0 comments on commit f2006f6

Please sign in to comment.