Channel_Impl.java

00001 package ;
00002 
00003 
00011   // import configuration classes
00012 
00013 import config.*;
00014 
00015 
00016 class Channel_Impl implements Channel {
00017 
00018     // base attributes
00019 
00020   private config.Configuration p_db;
00021   private config.ConfigObject p_obj;
00022   private boolean p_was_read;
00023   private boolean p_is_valid;
00024   private String p_uid;
00025   private String p_class_name;
00026 
00027 
00028     // database class attributes
00029 
00030   private short m_id;
00031   private short m_outputCurrent;
00032   private short m_outputDelay;
00033   private short m_outputMarkSpace;
00034   private short m_stream0Threshold;
00035   private short m_stream0Delay;
00036   private short m_stream0ErrMask;
00037   private short m_stream1Threshold;
00038   private short m_stream1Delay;
00039   private short m_stream1ErrMask;
00040   private short m_outputFibre;
00041   private short m_stream0Fibre;
00042   private short m_stream1Fibre;
00043 
00044 
00045     // database class relationships
00046 
00047 
00048 
00049 
00050     // constructor
00051 
00052   public Channel_Impl() {
00053     p_is_valid = false;
00054   }
00055 
00056   public Channel_Impl(config.Configuration db, config.ConfigObject obj) {
00057     init_config_params(db, obj);
00058   }
00059 
00060   public void init_config_params(config.Configuration db, config.ConfigObject obj) {
00061     p_db = db;
00062     p_obj = obj;
00063     p_was_read = false;
00064     p_is_valid = true;
00065     p_uid = p_obj.UID();
00066     p_class_name = p_obj.class_name();
00067   }
00068 
00069   public String UID() {
00070     return p_uid;
00071   }
00072 
00073   public String class_name() {
00074     return p_class_name;
00075   }
00076 
00077   public void update(boolean set_non_valid) {
00078     if(set_non_valid == true) {
00079       p_is_valid = false;
00080     }
00081     else {
00082       p_was_read = false;
00083       p_obj.clean();
00084       init();
00085     }
00086   }
00087 
00088   public void unread() {
00089     p_was_read = false;
00090   }
00091 
00092   public boolean is_valid() {
00093     return p_is_valid;
00094   }
00095 
00096 
00097 
00098   private void init() throws config.NotFoundException, config.NotValidException, config.SystemException {
00099     if(p_was_read == true) {return;}
00100 
00101     if(p_is_valid == false) {
00102       String text = "ERROR [.Channel_Impl.init()]: object " + p_uid + "@" + p_class_name + " is not valid";
00103       System.err.println(text);
00104       throw new config.NotValidException(text);
00105     }
00106 
00107     m_id = p_obj.get_short("id");
00108 
00109     m_outputCurrent = p_obj.get_short("outputCurrent");
00110 
00111     m_outputDelay = p_obj.get_short("outputDelay");
00112 
00113     m_outputMarkSpace = p_obj.get_short("outputMarkSpace");
00114 
00115     m_stream0Threshold = p_obj.get_short("stream0Threshold");
00116 
00117     m_stream0Delay = p_obj.get_short("stream0Delay");
00118 
00119     m_stream0ErrMask = p_obj.get_short("stream0ErrMask");
00120 
00121     m_stream1Threshold = p_obj.get_short("stream1Threshold");
00122 
00123     m_stream1Delay = p_obj.get_short("stream1Delay");
00124 
00125     m_stream1ErrMask = p_obj.get_short("stream1ErrMask");
00126 
00127     m_outputFibre = p_obj.get_short("outputFibre");
00128 
00129     m_stream0Fibre = p_obj.get_short("stream0Fibre");
00130 
00131     m_stream1Fibre = p_obj.get_short("stream1Fibre");
00132 
00133 
00134     p_was_read = true;
00135 
00136   }
00137 
00138   public short get_id() {
00139     if(p_was_read == false) {init();}
00140     return m_id;
00141   }
00142 
00143   public void set_id(short value) {
00144     p_obj.clean();
00145     p_obj.set_short("id", value);
00146   }
00147 
00148   public short get_outputCurrent() {
00149     if(p_was_read == false) {init();}
00150     return m_outputCurrent;
00151   }
00152 
00153   public void set_outputCurrent(short value) {
00154     p_obj.clean();
00155     p_obj.set_short("outputCurrent", value);
00156   }
00157 
00158   public short get_outputDelay() {
00159     if(p_was_read == false) {init();}
00160     return m_outputDelay;
00161   }
00162 
00163   public void set_outputDelay(short value) {
00164     p_obj.clean();
00165     p_obj.set_short("outputDelay", value);
00166   }
00167 
00168   public short get_outputMarkSpace() {
00169     if(p_was_read == false) {init();}
00170     return m_outputMarkSpace;
00171   }
00172 
00173   public void set_outputMarkSpace(short value) {
00174     p_obj.clean();
00175     p_obj.set_short("outputMarkSpace", value);
00176   }
00177 
00178   public short get_stream0Threshold() {
00179     if(p_was_read == false) {init();}
00180     return m_stream0Threshold;
00181   }
00182 
00183   public void set_stream0Threshold(short value) {
00184     p_obj.clean();
00185     p_obj.set_short("stream0Threshold", value);
00186   }
00187 
00188   public short get_stream0Delay() {
00189     if(p_was_read == false) {init();}
00190     return m_stream0Delay;
00191   }
00192 
00193   public void set_stream0Delay(short value) {
00194     p_obj.clean();
00195     p_obj.set_short("stream0Delay", value);
00196   }
00197 
00198   public short get_stream0ErrMask() {
00199     if(p_was_read == false) {init();}
00200     return m_stream0ErrMask;
00201   }
00202 
00203   public void set_stream0ErrMask(short value) {
00204     p_obj.clean();
00205     p_obj.set_short("stream0ErrMask", value);
00206   }
00207 
00208   public short get_stream1Threshold() {
00209     if(p_was_read == false) {init();}
00210     return m_stream1Threshold;
00211   }
00212 
00213   public void set_stream1Threshold(short value) {
00214     p_obj.clean();
00215     p_obj.set_short("stream1Threshold", value);
00216   }
00217 
00218   public short get_stream1Delay() {
00219     if(p_was_read == false) {init();}
00220     return m_stream1Delay;
00221   }
00222 
00223   public void set_stream1Delay(short value) {
00224     p_obj.clean();
00225     p_obj.set_short("stream1Delay", value);
00226   }
00227 
00228   public short get_stream1ErrMask() {
00229     if(p_was_read == false) {init();}
00230     return m_stream1ErrMask;
00231   }
00232 
00233   public void set_stream1ErrMask(short value) {
00234     p_obj.clean();
00235     p_obj.set_short("stream1ErrMask", value);
00236   }
00237 
00238   public short get_outputFibre() {
00239     if(p_was_read == false) {init();}
00240     return m_outputFibre;
00241   }
00242 
00243   public void set_outputFibre(short value) {
00244     p_obj.clean();
00245     p_obj.set_short("outputFibre", value);
00246   }
00247 
00248   public short get_stream0Fibre() {
00249     if(p_was_read == false) {init();}
00250     return m_stream0Fibre;
00251   }
00252 
00253   public void set_stream0Fibre(short value) {
00254     p_obj.clean();
00255     p_obj.set_short("stream0Fibre", value);
00256   }
00257 
00258   public short get_stream1Fibre() {
00259     if(p_was_read == false) {init();}
00260     return m_stream1Fibre;
00261   }
00262 
00263   public void set_stream1Fibre(short value) {
00264     p_obj.clean();
00265     p_obj.set_short("stream1Fibre", value);
00266   }
00267 
00268   public config.ConfigObject config_object() {
00269     return p_obj;
00270   }
00271 
00272   public void print(String dx) {
00273     System.out.println(dx + "Channel object:" );
00274     System.out.println(dx + "  id: \'" + UID() + "\', class name: \'" + class_name() + "\'");
00275 
00276 
00277       // print attributes
00278 
00279     System.out.println(dx + "  id: " + get_id());
00280     System.out.println(dx + "  outputCurrent: " + Long.toHexString((long)get_outputCurrent()));
00281     System.out.println(dx + "  outputDelay: " + Long.toHexString((long)get_outputDelay()));
00282     System.out.println(dx + "  outputMarkSpace: " + Long.toHexString((long)get_outputMarkSpace()));
00283     System.out.println(dx + "  stream0Threshold: " + Long.toHexString((long)get_stream0Threshold()));
00284     System.out.println(dx + "  stream0Delay: " + Long.toHexString((long)get_stream0Delay()));
00285     System.out.println(dx + "  stream0ErrMask: " + Long.toHexString((long)get_stream0ErrMask()));
00286     System.out.println(dx + "  stream1Threshold: " + Long.toHexString((long)get_stream1Threshold()));
00287     System.out.println(dx + "  stream1Delay: " + Long.toHexString((long)get_stream1Delay()));
00288     System.out.println(dx + "  stream1ErrMask: " + Long.toHexString((long)get_stream1ErrMask()));
00289     System.out.println(dx + "  outputFibre: " + Long.toHexString((long)get_outputFibre()));
00290     System.out.println(dx + "  stream0Fibre: " + Long.toHexString((long)get_stream0Fibre()));
00291     System.out.println(dx + "  stream1Fibre: " + Long.toHexString((long)get_stream1Fibre()));
00292 
00293 
00294       // print relationships
00295 
00296   }
00297 
00303   public void destroy(config.Configuration db) {
00304     db.destroy(config_object());
00305   }
00306 }

Generated on Mon Feb 6 14:12:08 2006 for SCT DAQ/DCS Software - Java by  doxygen 1.4.6