Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:39

0001 #pragma once
0002 
0003 #include "NP.hh"
0004 #include "stra.h"
0005 
0006 struct SInst
0007 {
0008     static std::string Desc( const NP* _inst, int edge=10 ); 
0009     const NP* inst ; 
0010     SInst( const NP* _inst ); 
0011     std::string desc(int edge=10) const ; 
0012 
0013 };
0014 
0015 inline std::string SInst::Desc( const NP* _inst, int edge )
0016 {
0017     SInst si(_inst) ; 
0018     return si.desc(edge) ; 
0019 }
0020 
0021 inline SInst::SInst( const NP* _inst ) 
0022     :
0023     inst(_inst)
0024 {
0025     assert( inst->uifc == 'f' );  
0026     assert( inst->ebyte == 4 || inst->ebyte == 8 );  
0027     assert( inst->has_shape(-1,4,4)); 
0028 }
0029 
0030 inline std::string SInst::desc(int edge) const
0031 {
0032     std::stringstream ss ;
0033 
0034     int inst_num = inst->num_items() ; 
0035     ss << "[ SInst::desc inst_num " << inst_num << std::endl ;
0036 
0037     if( inst->ebyte == 4 )
0038     {
0039         const float* inst_values = inst->cvalues<float>() ; 
0040         ss << stra<float>::DescItems( inst_values, 16, inst_num, edge );
0041     }
0042     else if( inst->ebyte == 8 )
0043     {
0044         const double* inst_values = inst->cvalues<double>() ; 
0045         ss << stra<double>::DescItems( inst_values, 16, inst_num, edge );
0046     }
0047 
0048     ss << "] SInst::desc inst_num " << inst_num << std::endl ;
0049     std::string str = ss.str() ;
0050     return str ;
0051 }
0052 
0053