Some better imports and positioning of public and private components

This commit is contained in:
Anne de Jong 2024-04-18 19:12:02 +02:00
parent c20094fb3f
commit 52eb0206eb
8 changed files with 30 additions and 41 deletions

View File

@ -1,5 +1,7 @@
#![allow(dead_code)] #![allow(dead_code)]
use super::Stream; use super::Stream;
use super::StreamMetaData;
use crate::daq::streamdata::*;
use crate::config::{self, *}; use crate::config::{self, *};
use crate::daq::{self, *}; use crate::daq::{self, *};
use anyhow::{bail, Result}; use anyhow::{bail, Result};

View File

@ -7,7 +7,7 @@ use strum::EnumMessage;
use strum_macros; use strum_macros;
use std::sync::Arc; use std::sync::Arc;
use super::{streamstatus::StreamStatus, StreamMetaData}; use super::{streamstatus::StreamStatus, streamdata::StreamMetaData};
#[cfg(feature = "cpal-api")] #[cfg(feature = "cpal-api")]
pub mod api_cpal; pub mod api_cpal;

View File

@ -16,16 +16,15 @@ mod streammgr;
mod streammsg; mod streammsg;
mod streamstatus; mod streamstatus;
pub use daqconfig::*; // Module re-exports
pub use daqconfig::{DaqChannel, DaqConfig};
pub use datatype::*; pub use datatype::*;
pub use deviceinfo::*; pub use deviceinfo::DeviceInfo;
pub use qty::*; pub use qty::Qty;
pub use streamcmd::*; pub use streamhandler::StreamHandler;
pub use streamdata::*; pub use streammgr::StreamMgr;
pub use streamhandler::*; pub use streammsg::InStreamMsg;
pub use streammgr::*; pub use streamstatus::StreamStatus;
pub use streammsg::*;
pub use streamstatus::*;
#[cfg(feature = "record")] #[cfg(feature = "record")]
pub use record::*; pub use record::*;

View File

@ -1,14 +1,11 @@
use super::*; use super::*;
use crate::config::Flt; use crate::config::Flt;
use anyhow::{bail, Error, Result}; use anyhow::{bail, Error, Result};
use clap::builder::OsStr;
use crossbeam::atomic::AtomicCell; use crossbeam::atomic::AtomicCell;
use hdf5::types::{VarLenArray, VarLenUnicode}; use hdf5::types::{VarLenArray, VarLenUnicode};
use hdf5::{dataset, datatype, Dataset, File, H5Type}; use hdf5::{dataset, datatype, Dataset, File, H5Type};
use ndarray::ArrayView2; use ndarray::ArrayView2;
use num::traits::ops::mul_add; use clap::builder::OsStr;
use rayon::iter::Empty;
use serde::de::IntoDeserializer;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::str::FromStr; use std::str::FromStr;
use std::sync::atomic::{AtomicBool, Ordering::SeqCst}; use std::sync::atomic::{AtomicBool, Ordering::SeqCst};
@ -16,6 +13,9 @@ use std::sync::{Arc, Mutex};
use std::thread::{spawn, JoinHandle}; use std::thread::{spawn, JoinHandle};
use std::time::Duration; use std::time::Duration;
use strum::EnumMessage; use strum::EnumMessage;
use streammgr::*;
use streammsg::InStreamMsg;
use streamdata::*;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
/// Status of a recording /// Status of a recording

View File

@ -1,13 +1,5 @@
//! Provides stream messages that come from a running stream use crate::siggen::*;
use crate::config::*; use super::streammgr::SharedInQueue;
use crate::daq::Qty;
use crate::siggen::{Siggen, Source};
use anyhow::{bail, Result};
use crossbeam::channel::Sender;
use std::any::TypeId;
use std::sync::{Arc, RwLock};
use super::*;
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(feature = "python-bindings")] { if #[cfg(feature = "python-bindings")] {
use pyo3::exceptions::PyValueError; use pyo3::exceptions::PyValueError;
@ -15,17 +7,21 @@ if #[cfg(feature = "python-bindings")] {
use pyo3::{pymodule, pyclass, types::PyModule, PyResult}; use pyo3::{pymodule, pyclass, types::PyModule, PyResult};
} else {} } } else {} }
/// Commands that can be sent to a running stream /// Commands that can be sent to a running stream
pub enum StreamCommand { pub enum StreamCommand {
/// Add a new queue to a running stream /// Add a new queue to a running INPUT stream
AddInQueue(SharedInQueue), AddInQueue(SharedInQueue),
/// Remove a queue to a running stream /// Remove a queue to a running INPUT stream
RemoveInQueue(SharedInQueue), RemoveInQueue(SharedInQueue),
/// New signal generator config to be used /// New signal generator config to be used in OUTPUT stream
NewSiggen(Siggen), NewSiggen(Siggen),
/// Stop the thread, do not listen for data anymore. /// Stop the thread, do not listen for data anymore.
StopThread, StopThread,
// New signal generator source
// NewSiggenSource(Source)
} }

View File

@ -1,6 +1,7 @@
use crossbeam::channel::{unbounded, Receiver}; use crossbeam::channel::{unbounded, Receiver};
use super::*; use super::*;
use streammsg::InStreamMsg;
/// A stream handler registers a queue in the stream manager, and keeps the other end to /// A stream handler registers a queue in the stream manager, and keeps the other end to
/// get InStreamData from a running input stream. /// get InStreamData from a running input stream.

View File

@ -5,6 +5,9 @@ use crate::{
config::*, config::*,
siggen::{self, Siggen}, siggen::{self, Siggen},
}; };
use streamcmd::StreamCommand;
use streammsg::*;
use streamdata::*;
use anyhow::{bail, Error, Result}; use anyhow::{bail, Error, Result};
use array_init::from_iter; use array_init::from_iter;
use core::time; use core::time;

View File

@ -3,6 +3,7 @@ use crate::config::*;
use crate::daq::Qty; use crate::daq::Qty;
use crate::siggen::Siggen; use crate::siggen::Siggen;
use anyhow::{bail, Result}; use anyhow::{bail, Result};
use streamdata::*;
use crossbeam::channel::Sender; use crossbeam::channel::Sender;
use reinterpret::{reinterpret_slice, reinterpret_vec}; use reinterpret::{reinterpret_slice, reinterpret_vec};
use std::any::TypeId; use std::any::TypeId;
@ -33,16 +34,3 @@ pub enum InStreamMsg {
StreamStopped, StreamStopped,
} }
/// Stream types that can be started
///
#[cfg_attr(feature = "python-bindings", pyclass)]
#[derive(PartialEq, Clone, Copy)]
pub enum StreamType {
/// Input-only stream
Input,
/// Output-only stream
Output,
/// Input and output at the same time
Duplex,
}