Skip to content

Commit

Permalink
Add explicit to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
NogameNo-life committed Aug 1, 2023
1 parent dfe3ae9 commit a8a7adf
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
26 changes: 26 additions & 0 deletions PAC/common/PAC_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3227,6 +3227,32 @@ digital_io_device::digital_io_device( const char *dev_name, device::DEVICE_TYPE
digital_io_device::~digital_io_device()
{
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
#ifndef DEBUG_NO_IO_MODULES

int valve_DO2::get_state()
{
int b1 = get_DO( DO_INDEX_1 );
int b2 = get_DO( DO_INDEX_2 );
if ( b1 == b2 ) return -1;
return b2;
}
//-----------------------------------------------------------------------------
void valve_DO2::direct_on()
{
set_DO( DO_INDEX_1, 0 );
set_DO( DO_INDEX_2, 1 );
}
//-----------------------------------------------------------------------------
void valve_DO2::direct_off()
{
set_DO( DO_INDEX_1, 1 );
set_DO( DO_INDEX_2, 0 );
}

#endif // DEBUG_NO_IO_MODULES

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
valve::valve( bool is_on_fb, bool is_off_fb, const char *dev_name,
Expand Down
15 changes: 14 additions & 1 deletion PAC/common/PAC_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ class valve_DO1_DI2 : public valve
class valve_DO2_DI2 : public valve
{
public:
valve_DO2_DI2( const char *dev_name ):
explicit valve_DO2_DI2( const char *dev_name ):

Check warning on line 1307 in PAC/common/PAC_dev.h

View check run for this annotation

Codecov / codecov/patch

PAC/common/PAC_dev.h#L1307

Added line #L1307 was not covered by tests
valve( true, true, dev_name, DT_V, DST_V_DO2_DI2 )
{
}
Expand Down Expand Up @@ -3736,6 +3736,19 @@ class valve_DO2 : public valve
valve_DO2( const char *dev_name ): valve( dev_name, DT_V, DST_V_DO2 )
{
}
#ifndef DEBUG_NO_IO_MODULES
public:
int get_state();
void direct_on();
void direct_off();

private:
enum CONSTANTS
{
DO_INDEX_1 = 0, ///< Индекс канала дискретного выхода №1.
DO_INDEX_2, ///< Индекс канала дискретного выхода №2.
};
#endif // DEBUG_NO_IO_MODULES
};
//-----------------------------------------------------------------------------
class i_motor : public device
Expand Down

0 comments on commit a8a7adf

Please sign in to comment.