lib/spnet/storage/network_state.rb
# Produce a Network object from the current NetworkState object.
# @param [Hash] args Hashed arguments. The only key required is :sample_rate.
Produce a Network object from the current NetworkState object.
Produce a Network object from the current NetworkState object .
def make_network args
    raise ArgumentError, "args does not have :sample_rate key" unless args.has_key?(:sample_rate)
    sample_rate = args[:sample_rate]
    blocks = {}
    @block_states.each do |block_name, block_state|
      blocks[block_name] = block_state.make_block :sample_rate => sample_rate
    end
    links = []
    @link_states.each do |link_state|
      links.push link_state.make_link blocks
    end
    Network.new :blocks => blocks, :links => links, :sample_rate => sample_rate
  end
def make_network args raise ArgumentError , "args does not have :sample_rate key" unless args . has_key? ( :sample_rate ) sample_rate = args [ :sample_rate ] blocks = { } @block_states . each do | block_name , block_state | blocks [ block_name ] = block_state . make_block :sample_rate => sample_rate end links = [ ] @link_states . each do | link_state | links . push link_state . make_link blocks end Network . new :blocks => blocks , :links => links , :sample_rate => sample_rate end
Produce a Network object from the current NetworkState object.
Produce a Network object from the current NetworkState object .
args
args Hashed arguments. The only key required is :sample_rate.
args Hashed arguments . The only key required is : sample_rate .